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 get the admincode1-3 ?!?!?!  XML
Forum Index -> Postal Codes
Author Message
Anonymous



ok this works fine:

http://ws.geonames.org/postalCodeSearchJSON?postalcode=91126&maxRows=1&country=DE

but it don't delivers admin1-3 like in your "Postal Code Search" in the menu above

Place Code Country Admin1 Admin2 Admin3
1 Schwabach 91126 Germany Bayern Mittelfranken Kreisfreie Stadt Schwabach
marc



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

Hi

With the parameter style=FULL or style=FULL you get more information :

http://ws.geonames.org/postalCodeSearchJSON?postalcode=91126&maxRows=1&country=DE&formatted=tr&style=lONG

admin3 however is missing, it will be added in the next couple of days.

Happy Holidays

Marc

[WWW]
dpc_map



Joined: 07/02/2007 04:02:37
Messages: 16
Offline

Can adminCode1 be included in the webservice postal code search? For example:

http://ws.geonames.org/postalCodeSearchJSON?placename=Albany&maxRows=10&country=US&adminCode1=NY&formatted=tr&style=LONG

doesn't limit the search to NY. I notice on the www.geonames.org postal code search page that I can enter "Albany, NY" and get back postal codes limited to NY, so perhaps there is some backend processing going on to filter the results of the query.

Also, for the geonames search webservice I can specify "name_equals". Is there something equivalent for postal searches?

Thank you.

Dan
marc



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

Hi Dan

adminCode1 is now a valid search parameter.


The equivalent to name_equals is the brand new placename_equals :

http://ws.geonames.org/postalCodeSearchJSON?placename_equals=Albany&maxRows=10&country=US


Marc

Edit : missing "h" for http added.

[WWW]
dpc_map



Joined: 07/02/2007 04:02:37
Messages: 16
Offline

Marc,

Thank you for the quick response and enhancements. The addition of the adminCode1 and placename_equals works great.

In the link you provided with your reply, the "h" is missing from the "http". Can you correct that for future visitors to this thread?

Thanks for your help.

Dan
dpc_map



Joined: 07/02/2007 04:02:37
Messages: 16
Offline

The following query returns two locations:

http://ws.geonames.org/postalCodeSearchJSON?placename_equals=bathurst&maxRows=10&country=CA

The first is what I expected; the second location has Bathurst in its placename, but the placename isn't exactly Bathurst. So does placename_equals match exactly or look for the string in the placename? I'd like to be able to specify an exact match.

Thank you.

Dan
marc



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

You are right the first implementation was not correct. Should be fixed now. Can you give it a test?

Marc

[WWW]
dpc_map



Joined: 07/02/2007 04:02:37
Messages: 16
Offline

Marc,

The placename_equals is now matching exactly. Thank you for fixing this.

I've come across another problem with placename_equals. It doesn't take names with "spaces". I want to return the postal code for Pleasant Valley, NY.

I've tried

http://ws.geonames.org/postalCodeSearchJSON?placename_equals=pleasant+valley&maxRows=10&country=US&adminCode1=NY

and

http://ws.geonames.org/postalCodeSearchJSON?placename_equals=pleasant%20valley&maxRows=10&country=US&adminCode1=NY

I thought that "+" or "%20" are the proper url_encodings for a "space".

Am I encoding this wrong?

Thank you for your help.

Dan
marc



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

Hi Dan

I wasn't an encoding problem. It was a problem on the server side. Instead of searching for a place called "Pleasant Valley" it was searching for a place with the two names "Pleasant" and "Valley". A place with these two names does not exist and the search didn't find anything.


Cheers

Marc

[WWW]
dpc_map



Joined: 07/02/2007 04:02:37
Messages: 16
Offline

Marc,

Thank you for fixing the server problem.

Cheers,

Dan
 
Forum Index -> Postal Codes
Go to:   
Powered by JForum 2.1.5 © JForum Team