GeoNames Home | Postal Codes | Download / Webservice | About |
search

delicious Add this page to del.icio.us

GeoNames Data Access

You can either download a daily database export or use our webservices to directly access our data. This list of GeoNames web services in table format helps you get an overview over all GeoNames web services.
See the feature codes list for explanation on the feature codes used by GeoNames.

GeoNames is using ISO-3166 alpha2 country codes.

In case of questions or troubles you might find help in our forum.

GeoNames is mainly using REST webservices.
Important:
* Don't forget to url encode string parameters containing special characters or spaces. (Faq entry on url encoding)
* Use the JSON services if you want to use GeoNames from javascript, as most browsers do not allow to call xml services from ANOTHER server.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.
Paypal Donations are welcome.




Webservices

Geonames search
Webservice for the GeoNames full text search in xml and json format. See the service description for details.


Postal Code Search
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.
ParameterValueDescription
postalcodestring (postalcode or placename required)postal code
placenamestring (postalcode or placename required)all fields : placename,postal code, country, admin name (Important:urlencoded utf8)
countrystring : country code, ISO-3166 (optional)Default is all countries.
maxRowsinteger (optional)the maximal number of rows in the document returned by the service. Default is 10
stylestring 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

[more on free-geocoding ...]


Placename lookup with postalcode (JSON)
Webservice Type : REST /JSON
Url : ws.geonames.org/postalCodeLookupJSON?
Parameters : postalcode,country ,maxRows (default = 20),callback, charset (default = UTF-8)
Result : returns a list of places for the given postalcode in JSON format
Example http://ws.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT

Details for this service with an ajax step by step example for placename autocomplete


Find nearby postal codes / reverse geocoding
This service comes in two flavors. You can either pass the lat/long or a postalcode/placename.

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]


Postal code country info
Webservice Type : REST
Url : ws.geonames.org/postalCodeCountryInfo?
Result : countries for which postal code geocoding is available.
Example : http://ws.geonames.org/postalCodeCountryInfo?


Find nearby place name / reverse geocoding
Webservice Type : REST
Url : ws.geonames.org/findNearbyPlaceName?
Parameters : lat,lng, radius: radius in km (optional), maxRows : max number of rows (default 10)
style : SHORT,MEDIUM,LONG,FULL (default = MEDIUM), verbosity of returned xml document
Result : returns the closest populated place for the lat/lng query as xml document
Example:
http://ws.geonames.org/findNearbyPlaceName?lat=47.3&lng=9

This service is also available in JSON format :
http://ws.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9

[more reverse geocoding webservices]


Place Hierarchy Webservices

Children
Hierarchy
Siblings
Neighbours



Wikipedia Webservices

Find nearby Wikipedia Entries / reverse geocoding
Wikipedia full text search



JSON Webservices

Cities and Placenames
Recent Earthquakes
Weather Stations with most recent Weather Observation
Placename lookup with postalcode



Other Webservices

RSS to GeoRSS Conversion
Details on RSS to GeoRSS converter.
Semantic Web Webservices
Details on Geonames Semantic Web services.


Country Info (Bounding Box, Capital, Area in square km, Population)
Webservice Type : REST
Url : ws.geonames.org/countryInfo?
Parameters : country (default = all countries)
lang : ISO-639-1 language code (en,de,fr,it,es,...) (default = english)
Result : Country information : Capital, Population, Area in square km, Bounding Box of mainland
Example : http://ws.geonames.org/countryInfo?

An other countryInfo service is available as csv output :
Example : http://ws.geonames.org/countryInfoCSV?lang=it&country=DE

Note : The countries AE,CS,UM,VA, TL are missing in the XML version of this service. See the forum for details.


CountryCode / reverse geocoding
The iso country code of any given point.

Webservice Type : REST
Url : ws.geonames.org/countryCode?
Parameters : lat,lng, type, lang;
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]


Country Subdivision / reverse geocoding
The iso country code and the administrative subdivision of any given point.

Webservice Type : REST
Url : ws.geonames.org/countrycode?
Parameters : lat,lng, lang (default= names in local language);
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

This service is also available in JSON format : ws.geonames.org/countrySubdivisionJSON?lat=47.03&lng=10.2

[more reverse geocoding webservices]


Elevation - SRTM3
Shuttle Radar Topography Mission (SRTM) elevation data. SRTM consisted of a specially modified radar system that flew onboard the Space Shuttle Endeavour during an 11-day mission in February of 2000. The dataset covers land areas between 60 degrees north and 56 degrees south.
This web service is using SRTM3 data with data points located every 3-arc-second (approximately 90 meters) on a latitude/longitude grid. Documentation : Nasa

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


Elevation - GTOPO30
GTOPO30 is a global digital elevation model (DEM) with a horizontal grid spacing of 30 arc seconds (approximately 1 kilometer). GTOPO30 was derived from several raster and vector sources of topographic information. Documentation : USGS Gtopo30 Readme

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


Timezone
Webservice Type : REST
Url : ws.geonames.org/timezone?
Parameters : lat,lng;
Result : the timezone at the lat/lng with gmt offset (1. January) and dst offset (1. July)
Example http://ws.geonames.org/timezone?lat=47.01&lng=10.2

This service is also available in JSON format : http://ws.geonames.org/timezoneJSON?lat=47.01&lng=10.2





Geonames Webservice Spreadsheet

Barry Hunter from nearby.org.uk has compiled a spreadsheet with the GeoNames webservices.


Database Dump

The database dump is available in around 230 files. One file for each country or a single large file 'allCountries.zip' with the records of all countries.
The number of names per country and the feature class/feature code distribution is visible in the statistics section.

The files are using UTF8 encoding and are tabulator separated. Read the readme.txt for details.

http://download.geonames.org/export/dump


Support




Support GeoNames with a donation :