Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import psycopg2
- from osmapi import OsmApi
- username=u''
- password=u''
- api = OsmApi(username=username, password=password,
- changesetauto=True, changesetautotags={"comment": u"Remove addr:country_code"})
- pg_dsn='user=, password=, host= ,database='
- con = psycopg2.connect(pg_dsn)
- cur = con.cursor()
- cur.execute("select osm_id,name from planet_osm_polygon where admin_level='9' and boundary='administrative'")
- data = cur.fetchall()
- for poble in data:
- identificador = abs(poble[0])
- nom = poble[1]
- rel = api.RelationGet(identificador)
- if 'addr:country_code' in rel['tag']:
- del rel['tag']['addr:country_code']
- api.RelationUpdate(rel)
- api.flush()
- print 'commit: id={} poble={}'.format(identificador, nom)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement