Author |
Message |
08/06/2012 05:56:55
|
stewart
Joined: 22/05/2012 11:27:45
Messages: 12
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
|
|
|
08/06/2012 17:50:31
|
geotree
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 |
|
|
11/06/2012 14:21:30
|
stewart
Joined: 22/05/2012 11:27:45
Messages: 12
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"
},
|
|
|
11/06/2012 14:21:30
|
stewart
Joined: 22/05/2012 11:27:45
Messages: 12
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.
|
|
|
|