Commit 8f05a40b authored by Branko Kokanovic's avatar Branko Kokanovic

more fixes for building_fix_apartments

parent 689f661e
......@@ -2,7 +2,7 @@ import csv
import logging
import logging.handlers
import osmapi
import time
def setup_logger(filename: str):
"""Simple logger used throughout whole scrapper - logs both to file and console."""
......@@ -26,7 +26,7 @@ def setup_logger(filename: str):
logger = setup_logger('fixes.log')
api = osmapi.OsmApi(passwordfile='osm-password',
changesetauto=True, changesetautosize=50, changesetautotags=
changesetauto=True, changesetautosize=100, changesetautotags=
{u"comment": u"Serbian lint bot "
"(https://gitlab.com/stalker314314/stambene-zajednice-analysis). "
"Adding building=apartments on government provided open dataset",
......@@ -61,21 +61,24 @@ def main():
for sz in stambene_zajednice:
if sz['processed'] and sz['way'] and sz['building_tag_present'] and not sz['building_is_apartments']:
i = i + 1
if i < 0: # If you need to skip already processed, set this to value greater than 0
if i % 100 == 0:
logger.info('Progress: {0}/{1}'.format(i, count))
if i < 20: # Skip already processed
continue
logger.info('Progress: {0}/{1}'.format(i, count))
way = api.WayGet(sz['way'])
if 'building' not in way['tag']:
logger.warning('{0} is missing building tag, skipping'.format(sz['way']))
continue
if way['tag']['building'] == 'apartments':
logger.warning('{0} already have building=apartments tag, skipping'.format(sz['way']))
time.sleep(5)
continue
for k, v in way['tag'].items():
logger.info('{0}: {1}'.format(k, v))
logger.info('https://www.openstreetmap.org/way/{0}'.format(sz['way']))
to_continue = input('Proceed (y/n):')
if to_continue == 'y':
if to_continue == '' or to_continue == 'y':
way['tag']['building'] = 'apartments'
api.WayUpdate(way)
api.flush()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment