Skip to content

Instantly share code, notes, and snippets.

@srikanthlogic
Last active October 31, 2016 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srikanthlogic/5148571367bb829b03c2170af59880c4 to your computer and use it in GitHub Desktop.
Save srikanthlogic/5148571367bb829b03c2170af59880c4 to your computer and use it in GitHub Desktop.
243059228 தேனாம்பேட்டை
245581303 நாங்குநேரி
from osmapi import OsmApi
import json
import overpy
import csv
import codecs
def utf_8_encoder(unicode_csv_data):
for line in unicode_csv_data:
yield line.encode('utf-8')
myOSMAPI = OsmApi(username="SrikanthLogic", password="*********")
with codecs.open('/media/data/code/osm-ta/csv-example.csv', 'r', 'utf-8') as csvfile:
myOSMAPI.ChangesetCreate({u"comment": u"Tamil Translation - Indian Cities"})
translation = csv.reader(utf_8_encoder(csvfile),delimiter=',')
for place in translation:
nodeJSON = myOSMAPI.NodeGet(place[0])
if("name:ta" not in nodeJSON["tag"].keys()):
newnodeJSON = {}
newnodeJSON["id"] = nodeJSON["id"]
newnodeJSON["lat"] = nodeJSON["lat"]
newnodeJSON["lon"] = nodeJSON["lon"]
newnodeJSON["tag"] = nodeJSON["tag"]
newnodeJSON["tag"]["name:ta"] = place[1].decode('utf-8')
#newnodeJSON["tag"]["name:ta"] = place[1]
myOSMAPI.NodeUpdate(nodeJSON)
myOSMAPI.ChangesetClose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment