GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How can I get the name of a city in several languages?  XML
Forum Index -> General
Author Message
jul



Joined: 21/11/2009 18:00:09
Messages: 4
Offline

hi,

is that possible to get the name of a city, given its geonameId, in several languages, and with one request?
I'm currently using

http://ws.geonames.org/getJSON?geonameId=xxxxxx

and get the alternateNames 'name' value for the 'lang' value I'm interested in.
The problem is that some results have several alternateNames with the same 'lang' value (e.g. new, york, big apple...).

How can I get the name returned by the request when setting a 'lang' value directly in the request?

thanks
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

The language code is only returned with the XML version of the request. For the XML request it was easy to add the info as attribute of the xml element without breaking the existing xml definition. For json it would need a refactoring of the returned object and it would break existing application.


Marc

[WWW]
jul



Joined: 21/11/2009 18:00:09
Messages: 4
Offline

ok, and how can it be done with the XML version of the request?
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

Where is the problem?
http://ws.geonames.org/get?geonameId=5128581&style=full


Marc

[WWW]
jul



Joined: 21/11/2009 18:00:09
Messages: 4
Offline

The problem is that if I want, for instance, the name in en, fr and es, using aternateNames with the corresponding 'lang' values, I get:


http://ws.geonames.org/get?geonameId=5128581&style=full

first alternateNames with lang value='en' -> Big Apple
first alternateNames with lang value='es' -> La Gran Manzana
first alternateNames with lang value='fr' -> New York

To get the correct names I need to run 3 requests and get the 'name':

http://ws.geonames.org/get?geonameId=5128581&lang=es
name-> Nueva York

http://ws.geonames.org/get?geonameId=5128581&lang=en
name-> New York

http://ws.geonames.org/get?geonameId=5128581&lang=fr
name-> New York

Can I do it in one request?

thanks for your replies
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

The hiearchy service returns only one name per language:
http://ws.geonames.org/hierarchy?geonameId=5128581&style=full

[WWW]
jul



Joined: 21/11/2009 18:00:09
Messages: 4
Offline

Great! thanks
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team