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 "
"( "
"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:'Progress: {0}/{1}'.format(i, count))
if i < 20: # Skip already processed
continue'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']))
if way['tag']['building'] == 'apartments':
logger.warning('{0} already have building=apartments tag, skipping'.format(sz['way']))
for k, v in way['tag'].items():'{0}: {1}'.format(k, v))'{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'
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