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

Geonames Search Webservice


Webservice Description

Url»ws.geonames.org/search?
Result»returns the names found for the searchterm as xml or json document, the search is using an AND operator

ParameterValueDescription
qstring (q,name or name_equals required)search over all attributes of a place : place name, country name, continent, admin codes,... (Important:urlencoded utf8)
namestring (q,name or name_equals required)place name only(Important:urlencoded utf8)
name_equalsstring (q,name or name_equals required)exact place name
maxRowsinteger (optional)the maximal number of rows in the document returned by the service. Default is 100, the maximal allowed value is 1000.
startRowinteger (optional)Used for paging results. If you want to get results 30 to 40, use startRow=30 and maxRows=10. Default is 0.
countrystring : country code, ISO-3166 (optional)Default is all countries. The country parameter may occur more then once, example: country=FR&country=GP
adminCode1, adminCode2, adminCode3string : admin code (optional)code of administrative subdivision
featureClasscharacter A,H,L,P,R,S,T,U,V (optional) featureclass(es) (default= all feature classes); this parameter may occur more then once, example: featureClass=P&featureClass=A
featureCodestring (optional)featurecode(s) (default= all feature codes); this parameter may occur more then once, example: featureCode=PPLC&featureCode=PPLX
langstring ISO-636 2-letter language code; en,de,fr,it,es,... (optional)place name and country name will be returned in the specified language. Default is English. Feature classes and codes are only available in English and Bulgarian. Any help in translating is welcome.
typestring xml,json,rdfthe format type of the returned document, default = xml
stylestring SHORT,MEDIUM,LONG,FULL (optional)verbosity of returned xml document, default = MEDIUM

 

Examples
XML
Example 1 : http://ws.geonames.org/search?q=london&maxRows=10

Example 2 : http://ws.geonames.org/search?q=london&maxRows=10&style=LONG&lang=es


JSON
http://ws.geonames.org/searchJSON?q=london&maxRows=10

JSON is easier to use in Javascript then XML, as a browser security feature will no allow you to call an xml service from an other domain. A simple example using the json service on googlemaps is here


Reverse Geocoding
Reverse geocoding is the process of finding a place name for a given latitude and longitude. Geonames has a wide range of reverse geocoding webservices.


RDF - Semantic Web
http://ws.geonames.org/search?q=london&maxRows=10&type=rdf

With the parameter type=rdf the search service returns the result in RDF format defined by the Geonames Semantic Web Ontology.


 

 

 




Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 License.