| GeoNames Home | Postal Codes | Download / Webservice | About | |
| Url | » | ws.geonames.org/postalCodeSearch? |
| Result | » | returns a list of postal codes and places for the placename/postalcode query as xml document For the US the first returned zip code is determined using zip code area shapes, the following zip codes are based on the centroid. For all other supported countries all returned postal codes are based on centroids. |
| Parameter | Value | Description |
|---|---|---|
| postalcode | string (postalcode or placename required) | postal code |
| postalcode_startsWith | string | the first characters or letters of a postal code |
| placename | string (postalcode or placename required) | all fields : placename,postal code, country, admin name (Important:urlencoded utf8) |
| placename_startsWith | string | the first characters of a place name |
| country | string : country code, ISO-3166 (optional) | Default is all countries. |
| countryBias | string | records from the countryBias are listed first |
| maxRows | integer (optional) | the maximal number of rows in the document returned by the service. Default is 10 |
| style | string SHORT,MEDIUM,LONG,FULL (optional) | verbosity of returned xml document, default = MEDIUM |
Example http://ws.geonames.org/postalCodeSearch?postalcode=9011&maxRows=10
This service is also available in JSON format : http://ws.geonames.org/postalCodeSearchJSON?postalcode=9011&maxRows=10
Details for this service with an ajax step by step example for placename autocomplete
Webservice Type : REST
Url : ws.geonames.org/findNearbyPostalCodes?
Parameters :
lat,lng, radius (in km), maxRows (default = 5),style (verbosity : SHORT,MEDIUM,LONG,FULL), country (default = all countries)
or
postalcode,country, radius (in Km), maxRows (default = 5)
Result : returns a list of postalcodes and places for the lat/lng query as xml document
Example:
http://ws.geonames.org/findNearbyPostalCodes?lat=47&lng=9
or
ws.geonames.org/findNearbyPostalCodes?postalcode=8775&country=CH&radius=10
This service is also available in JSON format : ws.geonames.org/findNearbyPostalCodesJSON?postalcode=8775&country=CH&radius=10
[more reverse geocoding webservices]
An other countryInfo service is available as csv output :
Example : http://ws.geonames.org/countryInfoCSV?lang=it&country=DE
Webservice Type : REST
Url : ws.geonames.org/countryCode?
Parameters : lat,lng, type, lang, radius (buffer in km for closest country in coastal areas);
Result : returns the iso country code for the given latitude/longitude
With the parameter type=xml this service returns an xml document with iso country code and country name. The optional parameter lang can be used to specify the language the country name should be in. JSON output is produced with type=JSON
Example http://ws.geonames.org/countryCode?lat=47.03&lng=10.2
[more reverse geocoding webservices]
Webservice Type : REST
Url : ws.geonames.org/countrySubdivision?
Parameters : lat,lng, lang (default= names in local language), radius (buffer in km for closest country in coastal areas);
Result : returns the country and the administrative subdivison (state, province,...) for the given latitude/longitude
Example http://ws.geonames.org/countrySubdivision?lat=47.03&lng=10.2
With the parameters 'radius' and 'maxRows' you get the closest subdivisions ordered by distance :
ws.geonames.org/countrySubdivision?lat=47.03&lng=10.2&maxRows=10&radius=40
This service is also available in JSON format : ws.geonames.org/countrySubdivisionJSON?lat=47.03&lng=10.2
Webservice Type : REST
Url : ws.geonames.org/neighbourhood?
Parameters : lat,lng
Result : returns the neighbourhood for the given latitude/longitude
Example http://ws.geonames.org/neighbourhood?lat=40.78343&lng=-73.96625
This service is also available in JSON format : ws.geonames.org/neighbourhoodJSON?lat=40.78343&lng=-73.96625
[more reverse geocoding webservices]
Webservice Type : REST
Url : ws.geonames.org/srtm3?
Parameters : lat,lng;
Result : a single number giving the elevation in meters according to srtm3, ocean
areas have been masked as "no data" and have been assigned a value of -32768
Example http://ws.geonames.org/srtm3?lat=50.01&lng=10.2
This service is also available in JSON format : ws.geonames.org/srtm3JSON?lat=50.01&lng=10.2
Webservice Type : REST
Url : ws.geonames.org/gtopo30?
Parameters : lat,lng;
Result : a single number giving the elevation in meters according to gtopo30, ocean
areas have been masked as "no data" and have been assigned a value of -9999
Example http://ws.geonames.org/gtopo30?lat=47.01&lng=10.2
This service is also available in JSON format : http://ws.geonames.org/gtopo30JSON?lat=47.01&lng=10.2