Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
S
stambene-zajednice-analysis
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Branko Kokanovic
stambene-zajednice-analysis
Commits
8f05a40b
Commit
8f05a40b
authored
Sep 04, 2019
by
Branko Kokanovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more fixes for building_fix_apartments
parent
689f661e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
src/fixes/building_fix_apartments.py
src/fixes/building_fix_apartments.py
+8
-5
No files found.
src/fixes/building_fix_apartments.py
View file @
8f05a40b
...
@@ -2,7 +2,7 @@ import csv
...
@@ -2,7 +2,7 @@ import csv
import
logging
import
logging
import
logging.handlers
import
logging.handlers
import
osmapi
import
osmapi
import
time
def
setup_logger
(
filename
:
str
):
def
setup_logger
(
filename
:
str
):
"""Simple logger used throughout whole scrapper - logs both to file and console."""
"""Simple logger used throughout whole scrapper - logs both to file and console."""
...
@@ -26,7 +26,7 @@ def setup_logger(filename: str):
...
@@ -26,7 +26,7 @@ def setup_logger(filename: str):
logger
=
setup_logger
(
'fixes.log'
)
logger
=
setup_logger
(
'fixes.log'
)
api
=
osmapi
.
OsmApi
(
passwordfile
=
'osm-password'
,
api
=
osmapi
.
OsmApi
(
passwordfile
=
'osm-password'
,
changesetauto
=
True
,
changesetautosize
=
5
0
,
changesetautotags
=
changesetauto
=
True
,
changesetautosize
=
10
0
,
changesetautotags
=
{
u"comment"
:
u"Serbian lint bot "
{
u"comment"
:
u"Serbian lint bot "
"(https://gitlab.com/stalker314314/stambene-zajednice-analysis). "
"(https://gitlab.com/stalker314314/stambene-zajednice-analysis). "
"Adding building=apartments on government provided open dataset"
,
"Adding building=apartments on government provided open dataset"
,
...
@@ -61,21 +61,24 @@ def main():
...
@@ -61,21 +61,24 @@ def main():
for
sz
in
stambene_zajednice
:
for
sz
in
stambene_zajednice
:
if
sz
[
'processed'
]
and
sz
[
'way'
]
and
sz
[
'building_tag_present'
]
and
not
sz
[
'building_is_apartments'
]:
if
sz
[
'processed'
]
and
sz
[
'way'
]
and
sz
[
'building_tag_present'
]
and
not
sz
[
'building_is_apartments'
]:
i
=
i
+
1
i
=
i
+
1
logger
.
info
(
'Progress: {0}/{1}'
.
format
(
i
,
count
))
if
i
<
0
:
# If you need to skip already processed, set this to value greater than 0
if
i
<
20
:
# Skip already processed
if
i
%
100
==
0
:
logger
.
info
(
'Progress: {0}/{1}'
.
format
(
i
,
count
))
continue
continue
logger
.
info
(
'Progress: {0}/{1}'
.
format
(
i
,
count
))
way
=
api
.
WayGet
(
sz
[
'way'
])
way
=
api
.
WayGet
(
sz
[
'way'
])
if
'building'
not
in
way
[
'tag'
]:
if
'building'
not
in
way
[
'tag'
]:
logger
.
warning
(
'{0} is missing building tag, skipping'
.
format
(
sz
[
'way'
]))
logger
.
warning
(
'{0} is missing building tag, skipping'
.
format
(
sz
[
'way'
]))
continue
continue
if
way
[
'tag'
][
'building'
]
==
'apartments'
:
if
way
[
'tag'
][
'building'
]
==
'apartments'
:
logger
.
warning
(
'{0} already have building=apartments tag, skipping'
.
format
(
sz
[
'way'
]))
logger
.
warning
(
'{0} already have building=apartments tag, skipping'
.
format
(
sz
[
'way'
]))
time
.
sleep
(
5
)
continue
continue
for
k
,
v
in
way
[
'tag'
]
.
items
():
for
k
,
v
in
way
[
'tag'
]
.
items
():
logger
.
info
(
'{0}: {1}'
.
format
(
k
,
v
))
logger
.
info
(
'{0}: {1}'
.
format
(
k
,
v
))
logger
.
info
(
'https://www.openstreetmap.org/way/{0}'
.
format
(
sz
[
'way'
]))
logger
.
info
(
'https://www.openstreetmap.org/way/{0}'
.
format
(
sz
[
'way'
]))
to_continue
=
input
(
'Proceed (y/n):'
)
to_continue
=
input
(
'Proceed (y/n):'
)
if
to_continue
==
'y'
:
if
to_continue
==
'
'
or
to_continue
==
'
y'
:
way
[
'tag'
][
'building'
]
=
'apartments'
way
[
'tag'
][
'building'
]
=
'apartments'
api
.
WayUpdate
(
way
)
api
.
WayUpdate
(
way
)
api
.
flush
()
api
.
flush
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment