| Author |
Message |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 29/11/2009 17:08:26
|
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
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 29/11/2009 17:42:48
|
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
|
 |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 29/11/2009 17:55:39
|
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?
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 30/11/2009 06:17:47
|
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
|
 |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 30/11/2009 12:07:58
|
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
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 30/11/2009 20:08:57
|
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
|
 |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 30/11/2009 20:47:27
|
jul
Joined: 21/11/2009 18:00:09
Messages: 4
Offline
|
Great! thanks
|
|
|
 |
|
|