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 to use same query as in a web page  XML
Forum Index -> Postal Codes
Author Message
velmur



Joined: 11/10/2017 18:52:32
Messages: 2
Offline

I tried to find a city by postal code here: http://www.geonames.org/search.html?q=18001&country=UA
And it works great.
Then I try to do the same using API with query:
http://api.geonames.org/search?username=demo&q=18001&country=UA
And its not works, 0 results! What am I doing wrong?
marc



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

Hi

The search on the www page falls back to the postalcode search if it does not find anything in the gazetteer.
The postalcode search api is this:
http://www.geonames.org/export/web-services.html#postalCodeSearch

The gazetteer dataset and the postalcode dataset are not yet fully integrated. Only a few country have the complete postalcodes already in the gazetteer data.

Best Regards

Marc

[WWW]
velmur



Joined: 11/10/2017 18:52:32
Messages: 2
Offline

Ok, thanks for your response. I tried search by postal code and its works now. But there another question.
I need to save location data into database so use for id`s geonamesId. But postal code not return geoname id, only search method can do that. So now each time when user wants to find city by postal code its 2 steps:
1. User types Country+postalcode and use postalCodeSearch method.
2. I getting data from response and do second query and search method with country+placeName+adminName.

In the result I have city name, region name and geonameId. But there couple problems exists. Some data can be lost, because search method not always return same result as postal code search. And 2 queries works slower than one.

So maybe exists some method that can give possibility to find city name by country+postalCode and will return placeName, adminName and geonameId?
 
Forum Index -> Postal Codes
Go to:   
Powered by JForum 2.1.5 © JForum Team