Search code examples
mysqlcharacter-encodingopenstreetmap

Open Street Map Address Decode


I am using Nominatim reverse geocoding service to get address from latitude and longitude. Then, store the result in Mysql Database. The coding is as fiddle below:

http://jsfiddle.net/GWL7A/171/

The address returned is in the local language such as in the example is in Chinese. And the data stored is not readable as:

"麒麟山新æ‘, 惠æ¥åŽ¿, 广东, 中åŽäººæ°‘共和国/China"
  1. Is that possible to make the address returned in English.
  2. If that's not possible, how to store the data into database so that when retrieve it and show in web UI, it returned to Chinese words? It must not be limited to only Chinese word since it might be Afghanistan, Thailand, Vietnam or some other country's addresses.

Thank you.


Solution

  • The object in question is not yet internationalized in OSM, so nominatim can only give you its original name (which is in Chinese). If you really need the name “in English”/in latin script, you probably have to do the transcription by yourself. I guess one can find some han-pinyin transcription library out there…

    btw: make sure to use the correct charset when adding the strings to your database. OSM is using utf-8.