GeoNames - Webservice

Started by Georg, Nov 04, 2025, 01:37 PM

0 Members and 1 Guest are viewing this topic.

Georg

geonames

...... search ...... SEARCH in Sri-Lanka at GeoNames ...  advanced-search

----- "Wiki interface" ----- links to "wikipedia pages" with "geoname"

The GeoNames database contains over 25,000,000 geographical names
... corresponding to over 11,800,000 unique features and 645 feature codes.



kandy ----- https://www.geonames.org/search.html?q=kandy&country=LK
Matale ----- https://www.geonames.org/search.html?q=Matale&country=LK


also work for some "mame" of Sight, Temple, Place, Tourism Attraction, ...
Fort MacDowall ----- https://www.geonames.org/search.html?q=Fort+MacDowall&country=LK

... but only if "name" is part of the place / locations / area / city




...

.... &featureCode=PPLQ ---- abandoned populated place

Test: http://api.geonames.org/search?q=sri-lanka&maxRows=100&&featureCode=PPLQ&username=chandis

...


GeoNames (or GeoNames.org) is a user-editable geographical database available and accessible through various web services,
GeoNames is under a Creative Commons attribution license. The project was founded in late 2005.

...



Georg

#1
----- GeoNames User Manual -----


------------------------------------------------
- GeoNames Manual
https://www.geonames.org/manual.html


------------------------------------------------
- GeoNames Web Services
https://www.geonames.org/export/


------------------------------------------------
- GeoNames Web Services Documentation
https://www.geonames.org/export/web-services.html


------------------------------------------------
- PHP script/code
https://pear.php.net/package/Services_GeoNames
https://github.com/pear/Services_GeoNames

Download pear: http://download.pear.php.net/package/Services_GeoNames-1.0.1.tgz

Download github: https://github.com/pear/Services_GeoNames/archive/refs/heads/trunk.zip


------------------------------------------------


GeoNames Sitemap


...




Georg

#2
 

geonames-search

https://www.geonames.org/export/geonames-search.html



Parameter Value Description

  • q string (q,name or name_equals required) search over all attributes of a place : place name, country name, continent, admin codes,... (Important:urlencoded utf8)
  • name string (q,name or name_equals required) place name only(Important:urlencoded utf8)
  • name_equals string (q,name or name_equals required) exact place name
  • name_startsWith string (optional) place name starts with given characters
  • maxRows integer (optional) the maximal number of rows in the document returned by the service. Default is 100, the maximal allowed value is 1000.
  • startRow integer (optional) Used for paging results. If you want to get results 30 to 40, use startRow=30 and maxRows=10. Default is 0, the maximal allowed value is 5000 for the free services and 25000 for the premium services
  • country string : country code, ISO-3166 (optional) Default is all countries. The country parameter may occur more than once, example: country=FR&country=GP
  • countryBias string (option), two letter country code ISO-3166 records from the countryBias are listed first
  • continentCode string : continent code : AF,AS,EU,NA,OC,SA,AN (optional) restricts the search for toponym of the given continent.
  • adminCode1, adminCode2, adminCode3, adminCode4, adminCode5 string : admin code (optional) code of administrative subdivision
  • featureClass character A,H,L,P,R,S,T,U,V (optional) featureclass(es) (default= all feature classes); this parameter may occur more than once, example: featureClass=P&featureClass=A
  • featureCode string (optional) featurecode(s) (default= all feature codes); this parameter may occur more than once, example: featureCode=PPLC&featureCode=PPLX
  • cities string (optional) optional filter parameter with three possible values 'cities1000', 'cities5000','cities15000' used to categorize the populated places into three groups according to size/relevance. See the download readme for further infos
  • lang string ISO-639 2-letter language code; en,de,fr,it,es,zh,zh-Hant... (optional) place name and country name will be returned in the specified language. Default is English. With the pseudo language code 'local' the local language will be returned. Feature classes and codes are only available in English and Bulgarian. Any help in translating is welcome.
  • type string xml,json,rdf the format type of the returned document, default = xml
  • style string SHORT,MEDIUM,LONG,FULL (optional) verbosity of returned xml document, default = MEDIUM
  • isNameRequired boolean (optional) At least one of the search term needs to be part of the place name. Example : A normal search for Berlin will return all places within the state of Berlin. If we only want to find places with 'Berlin' in the name we set the parameter isNameRequired to 'true'. The difference to the name_equals parameter is that this will allow searches for 'Berlin, Germany' as only one search term needs to be part of the name.
  • tag string (optional) search for toponyms tagged with the specified tag
  • operator string (optional) default is 'AND', with the operator 'OR' not all search terms need to be matched by the response
  • charset string (optional) default is 'UTF8', defines the encoding used for the document returned by the web service.
  • fuzzy float (optional) default is '1', defines the fuzziness of the search terms. float between 0 and 1. The search term is only applied to the name attribute.
  • east,west,north,south float (optional) bounding box, only features within the box are returned
  • searchlang string (optional) in combination with the name parameter, the search will only consider names in the specified language. Used for instance to query for IATA airport codes.
  • orderby string (optional)[population,elevation,relevance] in combination with the name_startsWith, if set to 'relevance' than the result is sorted by relevance.
  • inclBbox string (option) [true] include Bbox info, regardelss of style setting. (normally only included with style=FULL




------------------------------------------------------------------

geonames codes

------ P city, village,...

 
https://www.geonames.org/export/codes.html

...

featureClass   A,H,L,P,R,S,T,U,V

------------------------------------------------------------

A = country, state, region,...
H = stream, lake, ...
L = parks,area, ...
P = city, village,...
R = road, railroad
S = spot, building, farm
T = mountain,hill,rock,...
U = undersea
V = forest,heath,...


------------------------------------------------------------

...


... &featureCode=PPL
---------------------------------------
Test: http://api.geonames.org/search?q=sri-lanka&maxRows=20&style=LONG&featureCode=PPL&username=demo


... &featureClass=P
---------------------------------------
Test: http://api.geonames.org/search?q=sri-lanka&maxRows=100&style=LONG&featureClass=P&username=demo

...

...




Georg

#4



GeoNames WebServices overview


1     astergdem
2     children
3     contains
4     countryCode
5     countryInfo
6     countrySubdivision
7     earthquakes
8     extendedFindNearby
9     findNearby
10     findNearbyPlaceName
11     findNearbyPostalCodes
12     findNearbyStreets
13     findNearbyStreetsOSM
14     findNearByWeather
15     findNearbyWikipedia
16     findNearestAddress
17     findNearestIntersection
18     findNearestIntersectionOSM
19     findNearbyPOIsOSM
20     address
21     geoCodeAddress
22     streetNameLookup
23     get
24     gtopo30
25     hierarchy
26     neighbourhood
27     neighbours
28     ocean
29     postalCodeCountryInfo
30     postalCodeLookup
31     postalCodeSearch
32     rssToGeo
33     search
34     siblings
35     srtm1
36     srtm3
37     timezone
38     weather
39     weatherIcao
40     wikipediaBoundingBox
41     wikipediaSearch

 



...