GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
webservice fetaureCode setting  XML
Forum Index -> General
Author Message
stewart



Joined: 22/05/2012 11:27:45
Messages: 10
Offline

My apologies if this has been answered before. I expected the request below to only return items with the feature codes specified ('PPL', 'PPLC', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4' and 'ADM2'), but it seems to return all. Is this the expected behaviour?

http://ws.geonames.org/searchJSON?callback=jQuery16405379799662094792_1339080721158&type=json&countryBias=GB&maxRows=100&featureCode%5B%5D=PPL&featureCode%5B%5D=PPLC&featureCode%5B%5D=PPLA&featureCode%5B%5D=PPLA2&featureCode%5B%5D=PPLA3&featureCode%5B%5D=PPLA4&featureCode%5B%5D=ADM2&style=full&isNameRequired=true&q=barcelo&username=infotelSolutions&_=1339080993115
geotree


[Avatar]
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline

1/
The syntax is : &featureCode=value1&featureCode=value2

2/
ws.geonames.org is deprecated :
http://geonames.wordpress.com/2011/01/28/application-identification-for-free-geonames-web-services/
You should use http://api.geonames.org

Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html
[WWW]
stewart



Joined: 22/05/2012 11:27:45
Messages: 10
Offline

Thanks for that - especially the url!

I understand the syntax now. Can anybody offer any advice on how I can generate such a request using the jquery .ajax data: syntax? The %5b%5d is obviously coming from my array (see below).


data: {
style: "full",
countryBias:"GB",
maxRows: 200,
isNameRequired: true,
name: request.term,
lang: "en",
featureCode: ["PPL","PPLX"],
fuzzy: 0.8,
username: "stewart"
},
stewart



Joined: 22/05/2012 11:27:45
Messages: 10
Offline

Well and answer to my own question which I'll post because I'm sure others have the same issue and it took me a long time to sort out:

the jQuery .ajax command needs traditional:true to revert to traditional parameter serialization.
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team