Title: | Interface to the "Geonames" Spatial Query Web Service |
---|---|
Description: | The web service at <https://www.geonames.org/> provides a number of spatial data queries, including administrative area hierarchies, city locations and some country postal code queries. A (free) username is required and rate limits exist. |
Authors: | Barry Rowlingson |
Maintainer: | Barry Rowlingson <[email protected]> |
License: | GPL-3 |
Version: | 0.999 |
Built: | 2025-06-30 07:07:21 UTC |
Source: | https://github.com/ropensci/geonames |
www.geonames.org is a service where you can query for global geographicdata such as administrative areas, populated places, weather data etc.
The functions in this package are mostly thin wrappers to the APIcalls documented at the geonames web servicesoverviewhttp://www.geonames.org/export/ws-overview.html.
A set of example calls are supplied in a file with the package. Onceyou have set your geonames username withoptions(geonamesUsername="myusernamehere")
you can runthis withsource(system.file("tests","testing.R",package="geonames"),echo=TRUE)
Search for cities
GNcities(north, east, south, west, lang = "en", maxRows = 10)
GNcities(north, east, south, west, lang="en", maxRows=10)
north | north bound |
east | east bound |
south | south bound |
west | west bount |
lang | language code |
maxRows | max number of records to return |
find cities
API doc for GNcities is athttp://www.geonames.org/export/JSON-webservices.html#citiesJSON
city records
Barry Rowlingson
Get country code
GNcountryCode(lat, lng, lang = "", radius = "")
GNcountryCode(lat, lng, lang="", radius="")
lat | latitude |
lng | longitude |
lang | language code |
radius | radius size |
country code for location
API doc for GNcountryCode is athttp://www.geonames.org/export/web-services.html#countrycode
country record
Barry Rowlingson
Get country info
GNcountryInfo(country = "", lang = "")
GNcountryInfo(country="", lang="")
country | country code |
lang | language code |
country info
API doc for GNcountryInfo is athttp://www.geonames.org/export/web-services.html#countryInfo
country record info
Barry Rowlingson
country code and admin subdivision
GNcountrySubdivision(lat, lng, lang = "en", radius = "", maxRows = 10)
GNcountrySubdivision(lat, lng, lang="en", radius="", maxRows=10)
lat | latitude |
lng | longitude |
lang | language code |
radius | search radius |
maxRows | max number of returned records |
looks up country and admin subdivisions
API doc for GNcountrySubdivision is athttp://www.geonames.org/export/web-services.html#countrysubdiv
iso country code
Barry Rowlingson
recent earthquakes
GNearthquakes(north, east, south, west, date, minMagnitude, maxRows = 10)
GNearthquakes(north, east, south, west, date, minMagnitude, maxRows=10)
north | north bound |
east | east bound |
south | south bound |
west | west bound |
date | optional date |
minMagnitude | optional minimal magnitude |
maxRows | max records to return |
get recent earthquakes in a region
API doc for GNearthquakes is athttp://www.geonames.org/export/JSON-webservices.html#earthquakesJSON
earthquake records
Barry Rowlingson
## Not run: GNearthquakes(north=44.1,south=-9.9,east=-22.4,west=55.2)## End(Not run)
## Not run:GNearthquakes(north=44.1,south=-9.9,east=-22.4,west=55.2)## End(Not run)
find nearby entities
GNfindNearby(...)
GNfindNearby(...)
... | search parameters |
nearby search
API doc for GNfindNearby is athttp://www.geonames.org/export/web-services.html#findNearby
matched records
Barry Rowlingson
find nearby populated place
GNfindNearbyPlaceName(lat, lng, radius = "", maxRows = "10", style = "MEDIUM")
GNfindNearbyPlaceName(lat, lng, radius="", maxRows="10", style="MEDIUM")
lat | latitude |
lng | longitude |
radius | search radius |
maxRows | max records returned |
style | verbosity of record |
search for populated places
API doc for GNfindNearbyPlaceName is athttp://www.geonames.org/export/web-services.html#findNearbyPlaceName
nearby populated place records
Barry Rowlingson
find postal code by lat long or code
GNfindNearbyPostalCodes(...)
GNfindNearbyPostalCodes(...)
... | search parameters, see geonames web docs for details |
find postal code
API doc for GNfindNearbyPostalCodes is athttp://www.geonames.org/export/web-services.html#findNearbyPostalCodes
postal code records
Barry Rowlingson
find nearby streets (US only)
GNfindNearbyStreets(lat, lng)
GNfindNearbyStreets(lat, lng)
lat | latitude |
lng | longitude |
for a lat-long, find nearby US streets
API doc for GNfindNearbyStreets is athttp://www.geonames.org/maps/us-reverse-geocoder.html#findNearbyStreets
street records
Barry Rowlingson
get weather at location
GNfindNearByWeather(lat, lng)
GNfindNearByWeather(lat, lng)
lat | latitude |
lng | longitude |
get weather
API doc for GNfindNearByWeather is athttp://www.geonames.org/export/JSON-webservices.html#findNearByWeatherJSON
weather record
check capitalisation of 'NearBy'
Barry Rowlingson
## Not run: GNfindNearByWeather(57,-2)## End(Not run)
## Not run:GNfindNearByWeather(57,-2)## End(Not run)
find nearby wikipedia entries
GNfindNearbyWikipedia(...)
GNfindNearbyWikipedia(...)
... | see geonames.org documentation |
search wikipedia entries by lat/lng or location name parameters
API doc for GNfindNearbyWikipedia is athttp://www.geonames.org/export/wikipedia-webservice.html#findNearbyWikipedia
wikipedia entries
Barry Rowlingson
## Not run: GNfindNearbyWikipedia(postalcode=8775,country="CH",radius=10)## End(Not run)
## Not run:GNfindNearbyWikipedia(postalcode=8775,country="CH",radius=10)## End(Not run)
find nearest street and address
GNfindNearestAddress(lat, lng)
GNfindNearestAddress(lat, lng)
lat | latitude |
lng | longitude |
search US for nearest street and address
API doc for GNfindNearestAddress is athttp://www.geonames.org/maps/us-reverse-geocoder.html#findNearestAddress
address record
Barry Rowlingson
search US for nearest intersection
GNfindNearestIntersection(lat, lng)
GNfindNearestIntersection(lat, lng)
lat | latitude |
lng | longitude |
finds nearest intersection
API doc for GNfindNearestIntersection is athttp://www.geonames.org/maps/us-reverse-geocoder.html#findNearestIntersection
intersection record
Barry Rowlingson
height from topo30
GNgtopo30(lat, lng)
GNgtopo30(lat, lng)
lat | latitude |
lng | longitude |
get height from topo30 data
API doc for GNgtopo30 is athttp://www.geonames.org/export/web-services.html#gtopo30
height record
Barry Rowlingson
## Not run: GNgtopo30(lat=54,lng=-1)## End(Not run)
## Not run:GNgtopo30(lat=54,lng=-1)## End(Not run)
find neighbourhood
GNneighbourhood(lat, lng)
GNneighbourhood(lat, lng)
lat | latitude |
lng | longitude |
find neighbourhood
API doc for GNneighbourhood is athttp://www.geonames.org/export/web-services.html#neighbourhood
neighbourhood records
Barry Rowlingson
countries with postal code info
GNpostalCodeCountryInfo()
GNpostalCodeCountryInfo()
list countries with postal code info
API doc for GNpostalCodeCountryInfo is athttp://www.geonames.org/export/web-services.html#postalCodeCountryInfo
list of countries with postal codes on geonames
Barry Rowlingson
postal code lookup
GNpostalCodeLookup(...)
GNpostalCodeLookup(...)
... | parameters |
postal code lookup
API doc for GNpostalCodeLookup is athttp://www.geonames.org/export/web-services.html#postalCodeLookupJSON
list of places for a given input postal code
Barry Rowlingson
search for postal code
GNpostalCodeSearch(...)
GNpostalCodeSearch(...)
... | search parameters |
full text search for postal codes
API doc for GNpostalCodeSearch is athttp://www.geonames.org/export/web-services.html#postalCodeSearch
postal code record
Barry Rowlingson
search geonames
GNsearch(...)
GNsearch(...)
... | search parameters |
general search call
API doc for GNsearch is athttp://www.geonames.org/export/geonames-search.html
matched records
Barry Rowlingson
## Not run: # Find places called Lancaster and 'geocode' the result(lanc_df <- GNsearch(name = "Lancaster", country = "UK"))lanc_coords <- lanc_df[1, c("lng", "lat")]## End(Not run)
## Not run:# Find places called Lancaster and 'geocode' the result(lanc_df<- GNsearch(name="Lancaster", country="UK"))lanc_coords<- lanc_df[1, c("lng","lat")]## End(Not run)
height from srtm3 data
GNsrtm3(lat, lng)
GNsrtm3(lat, lng)
lat | latitude |
lng | longitude |
get srtm3 height
API doc for GNsrtm3 is athttp://www.geonames.org/export/web-services.html#srtm3
height record
Barry Rowlingson
## Not run: GNsrtm3(lat=54,lng=-1)## End(Not run)
## Not run:GNsrtm3(lat=54,lng=-1)## End(Not run)
get timezone
GNtimezone(lat, lng, radius = 0)
GNtimezone(lat, lng, radius=0)
lat | latitude |
lng | longitude |
radius | sesarch radius |
timezone for location
API doc for GNtimezone is athttp://www.geonames.org/export/web-services.html#timezone
time zone record
Barry Rowlingson
weather stations in region
GNweather(north, east, south, west, maxRows = 10)
GNweather(north, east, south, west, maxRows=10)
north | north bound |
east | east bound |
south | south bound |
west | west bound |
maxRows | max records to return |
get weather stations in region with latest readings
weather records
Barry Rowlingson
weather record from ICAO station
GNweatherIcao(ICAO)
GNweatherIcao(ICAO)
ICAO | ICAO code |
get most recent ICAO station data
API doc for GNweatherIcao is athttp://www.geonames.org/export/JSON-webservices.html#weatherIcaoJSON
weather record
Barry Rowlingson
wikipedia articles in bounding box
GNwikipediaBoundingBox(...)
GNwikipediaBoundingBox(...)
... | parameters (north, south, east, west etc.) |
find articles in a box
API doc for GNwikipediaBoundingBox is athttp://www.geonames.org/export/wikipedia-webservice.html#wikipediaBoundingBox
wikipedia records
Barry Rowlingson
## Not run: GNwikipediaBoundingBox(north=44.1,south=-9.9,east=-22.4,west=55.2)## End(Not run)
## Not run:GNwikipediaBoundingBox(north=44.1,south=-9.9,east=-22.4,west=55.2)## End(Not run)
wikipedia fulltext search
GNwikipediaSearch(q, maxRows = 10)
GNwikipediaSearch(q, maxRows=10)
q | search string |
maxRows | maximum returned records |
find geolocated articles in wikipedia
API doc for GNwikipediaSearch is athttp://www.geonames.org/export/wikipedia-webservice.html#wikipediaSearch
wikipedia entries
Barry Rowlingson
## Not run: GNwikipediaSearch("london")## End(Not run)
## Not run:GNwikipediaSearch("london")## End(Not run)
Seehttp://www.geonames.org/export/ws-overview.htmlfor a full description of valid arguments and return values
GNchildren(geonameId, ...)GNhierarchy(geonameId, ...)GNsiblings(geonameId, ...)GNneighbours(geonameId, ...)
GNchildren(geonameId,...)GNhierarchy(geonameId,...)GNsiblings(geonameId,...)GNneighbours(geonameId,...)
geonameId | a geonames ID value |
... | other parameters to pass to geonames |
API doc for GNchildren is athttp://www.geonames.org/export/place-hierarchy.html#children
API doc for GNhierarchy is athttp://www.geonames.org/export/place-hierarchy.html#hierarchy
API doc for GNsiblings is athttp://www.geonames.org/export/place-hierarchy.html#siblings
API doc for GNneighbours is athttp://www.geonames.org/export/place-hierarchy.html#neighbours