Package 'geonames'

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: 2024-10-28 06:06:20 UTC
Source: https://github.com/ropensci/geonames

Help Index


Query the geonames web API for geographic data

Description

www.geonames.org is a service where you can query for global geographic data such as administrative areas, populated places, weather data etc.

Details

The functions in this package are mostly thin wrappers to the API calls documented at the geonames web services overview http://www.geonames.org/export/ws-overview.html.

A set of example calls are supplied in a file with the package. Once you have set your geonames username with options(geonamesUsername="myusernamehere") you can run this with source(system.file("tests","testing.R",package="geonames"),echo=TRUE)


find cities

Description

Search for cities

Usage

GNcities(north, east, south, west, lang = "en", maxRows = 10)

Arguments

north

north bound

east

east bound

south

south bound

west

west bount

lang

language code

maxRows

max number of records to return

Details

find cities

API doc for GNcities is at http://www.geonames.org/export/JSON-webservices.html#citiesJSON

Value

city records

Author(s)

Barry Rowlingson


country code for location

Description

Get country code

Usage

GNcountryCode(lat, lng, lang = "", radius = "")

Arguments

lat

latitude

lng

longitude

lang

language code

radius

radius size

Details

country code for location

API doc for GNcountryCode is at http://www.geonames.org/export/web-services.html#countrycode

Value

country record

Author(s)

Barry Rowlingson


country info

Description

Get country info

Usage

GNcountryInfo(country = "", lang = "")

Arguments

country

country code

lang

language code

Details

country info

API doc for GNcountryInfo is at http://www.geonames.org/export/web-services.html#countryInfo

Value

country record info

Author(s)

Barry Rowlingson


country code and subdivision

Description

country code and admin subdivision

Usage

GNcountrySubdivision(lat, lng, lang = "en", radius = "",
  maxRows = 10)

Arguments

lat

latitude

lng

longitude

lang

language code

radius

search radius

maxRows

max number of returned records

Details

looks up country and admin subdivisions

API doc for GNcountrySubdivision is at http://www.geonames.org/export/web-services.html#countrysubdiv

Value

iso country code

Author(s)

Barry Rowlingson


recent earthquakes

Description

recent earthquakes

Usage

GNearthquakes(north, east, south, west, date, minMagnitude, maxRows = 10)

Arguments

north

north bound

east

east bound

south

south bound

west

west bound

date

optional date

minMagnitude

optional minimal magnitude

maxRows

max records to return

Details

get recent earthquakes in a region

API doc for GNearthquakes is at http://www.geonames.org/export/JSON-webservices.html#earthquakesJSON

Value

earthquake records

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNearthquakes(north=44.1,south=-9.9,east=-22.4,west=55.2)

## End(Not run)

nearby search

Description

find nearby entities

Usage

GNfindNearby(...)

Arguments

...

search parameters

Details

nearby search

API doc for GNfindNearby is at http://www.geonames.org/export/web-services.html#findNearby

Value

matched records

Author(s)

Barry Rowlingson


populated place search

Description

find nearby populated place

Usage

GNfindNearbyPlaceName(lat, lng, radius = "", maxRows = "10",
  style = "MEDIUM")

Arguments

lat

latitude

lng

longitude

radius

search radius

maxRows

max records returned

style

verbosity of record

Details

search for populated places

API doc for GNfindNearbyPlaceName is at http://www.geonames.org/export/web-services.html#findNearbyPlaceName

Value

nearby populated place records

Author(s)

Barry Rowlingson


find postal code

Description

find postal code by lat long or code

Usage

GNfindNearbyPostalCodes(...)

Arguments

...

search parameters, see geonames web docs for details

Details

find postal code

API doc for GNfindNearbyPostalCodes is at http://www.geonames.org/export/web-services.html#findNearbyPostalCodes

Value

postal code records

Author(s)

Barry Rowlingson


nearby street finding

Description

find nearby streets (US only)

Usage

GNfindNearbyStreets(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

for a lat-long, find nearby US streets

API doc for GNfindNearbyStreets is at http://www.geonames.org/maps/us-reverse-geocoder.html#findNearbyStreets

Value

street records

Author(s)

Barry Rowlingson


weather at location

Description

get weather at location

Usage

GNfindNearByWeather(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

get weather

API doc for GNfindNearByWeather is at http://www.geonames.org/export/JSON-webservices.html#findNearByWeatherJSON

Value

weather record

Note

check capitalisation of 'NearBy'

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNfindNearByWeather(57,-2)

## End(Not run)

nearby wikipedia entries

Description

find nearby wikipedia entries

Usage

GNfindNearbyWikipedia(...)

Arguments

...

see geonames.org documentation

Details

search wikipedia entries by lat/lng or location name parameters

API doc for GNfindNearbyWikipedia is at http://www.geonames.org/export/wikipedia-webservice.html#findNearbyWikipedia

Value

wikipedia entries

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNfindNearbyWikipedia(postalcode=8775,country="CH",radius=10)

## End(Not run)

nearest address

Description

find nearest street and address

Usage

GNfindNearestAddress(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

search US for nearest street and address

API doc for GNfindNearestAddress is at http://www.geonames.org/maps/us-reverse-geocoder.html#findNearestAddress

Value

address record

Author(s)

Barry Rowlingson


nearest intersection

Description

search US for nearest intersection

Usage

GNfindNearestIntersection(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

finds nearest intersection

API doc for GNfindNearestIntersection is at http://www.geonames.org/maps/us-reverse-geocoder.html#findNearestIntersection

Value

intersection record

Author(s)

Barry Rowlingson


topo30 height

Description

height from topo30

Usage

GNgtopo30(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

get height from topo30 data

API doc for GNgtopo30 is at http://www.geonames.org/export/web-services.html#gtopo30

Value

height record

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNgtopo30(lat=54,lng=-1)

## End(Not run)

neighbourhood

Description

find neighbourhood

Usage

GNneighbourhood(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

find neighbourhood

API doc for GNneighbourhood is at http://www.geonames.org/export/web-services.html#neighbourhood

Value

neighbourhood records

Author(s)

Barry Rowlingson


postal code info

Description

countries with postal code info

Usage

GNpostalCodeCountryInfo()

Details

list countries with postal code info

API doc for GNpostalCodeCountryInfo is at http://www.geonames.org/export/web-services.html#postalCodeCountryInfo

Value

list of countries with postal codes on geonames

Author(s)

Barry Rowlingson


postal code lookup

Description

postal code lookup

Usage

GNpostalCodeLookup(...)

Arguments

...

parameters

Details

postal code lookup

API doc for GNpostalCodeLookup is at http://www.geonames.org/export/web-services.html#postalCodeLookupJSON

Value

list of places for a given input postal code

Author(s)

Barry Rowlingson


postal code search

Description

search for postal code

Usage

GNpostalCodeSearch(...)

Arguments

...

search parameters

Details

full text search for postal codes

API doc for GNpostalCodeSearch is at http://www.geonames.org/export/web-services.html#postalCodeSearch

Value

postal code record

Author(s)

Barry Rowlingson


search geonames

Description

search geonames

Usage

GNsearch(...)

Arguments

...

search parameters

Details

general search call

API doc for GNsearch is at http://www.geonames.org/export/geonames-search.html

Value

matched records

Author(s)

Barry Rowlingson

Examples

## 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)

srtm3 height

Description

height from srtm3 data

Usage

GNsrtm3(lat, lng)

Arguments

lat

latitude

lng

longitude

Details

get srtm3 height

API doc for GNsrtm3 is at http://www.geonames.org/export/web-services.html#srtm3

Value

height record

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNsrtm3(lat=54,lng=-1)

## End(Not run)

timezone for location

Description

get timezone

Usage

GNtimezone(lat, lng, radius = 0)

Arguments

lat

latitude

lng

longitude

radius

sesarch radius

Details

timezone for location

API doc for GNtimezone is at http://www.geonames.org/export/web-services.html#timezone

Value

time zone record

Author(s)

Barry Rowlingson


weather stations in box

Description

weather stations in region

Usage

GNweather(north, east, south, west, maxRows = 10)

Arguments

north

north bound

east

east bound

south

south bound

west

west bound

maxRows

max records to return

Details

get weather stations in region with latest readings

Value

weather records

Author(s)

Barry Rowlingson


ICAO weather station data

Description

weather record from ICAO station

Usage

GNweatherIcao(ICAO)

Arguments

ICAO

ICAO code

Details

get most recent ICAO station data

API doc for GNweatherIcao is at http://www.geonames.org/export/JSON-webservices.html#weatherIcaoJSON

Value

weather record

Author(s)

Barry Rowlingson


wikipedia articles in a box

Description

wikipedia articles in bounding box

Usage

GNwikipediaBoundingBox(...)

Arguments

...

parameters (north, south, east, west etc.)

Details

find articles in a box

API doc for GNwikipediaBoundingBox is at http://www.geonames.org/export/wikipedia-webservice.html#wikipediaBoundingBox

Value

wikipedia records

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNwikipediaBoundingBox(north=44.1,south=-9.9,east=-22.4,west=55.2)

## End(Not run)

search wikipedia

Description

wikipedia fulltext search

Usage

GNwikipediaSearch(q, maxRows = 10)

Arguments

q

search string

maxRows

maximum returned records

Details

find geolocated articles in wikipedia

API doc for GNwikipediaSearch is at http://www.geonames.org/export/wikipedia-webservice.html#wikipediaSearch

Value

wikipedia entries

Author(s)

Barry Rowlingson

Examples

## Not run: 
GNwikipediaSearch("london")

## End(Not run)

Admin area hierarchy

Description

See http://www.geonames.org/export/ws-overview.html for a full description of valid arguments and return values

Usage

GNchildren(geonameId, ...)

GNhierarchy(geonameId, ...)

GNsiblings(geonameId, ...)

GNneighbours(geonameId, ...)

Arguments

geonameId

a geonames ID value

...

other parameters to pass to geonames

Details

API doc for GNchildren is at http://www.geonames.org/export/place-hierarchy.html#children

API doc for GNhierarchy is at http://www.geonames.org/export/place-hierarchy.html#hierarchy

API doc for GNsiblings is at http://www.geonames.org/export/place-hierarchy.html#siblings

API doc for GNneighbours is at http://www.geonames.org/export/place-hierarchy.html#neighbours