georef | R Documentation |
The function returns the first hit into a data frame with latitude, longitude, location name, url/id, and searched query from the gazetteers Pelagios (default) and Geonames (as well as from the georeferenced Wikipedia articles stored in the GeoNames database). To get everything, not just the first hit, set the parameter to output = "all". GeoNames requires a user account (free) to use their API services.
georef(location, output = c("latlon", "all"), source = c("pelagios", "geowiki_all", "geowiki_title", "geonames"), messaging = FALSE, urlonly = FALSE, inject = "", language = "", place.pelagios = "", bounding.box = "", bbox = "")
location |
a character vector of place names (e.g. "Rome") |
output |
amount of output: "latlon" (default), "all" (gives a list of everything not just a selected dataframe). |
source |
"pelagios" for Pelagios (default); "geonames" for a simple search in GeoNames; "geowiki_title" for search just the title in Wikipedia database from GeoNames; "geowiki_all" for search in Wikipedia database from GeoNames. |
inject |
character string to add to the url. It is mandatory for "geonames", "geowiki_all", "geowiki_title": inject = "username=your_geoname_username" (without blankspaces). |
language |
character string to add to the language for "geowiki_all", "geowiki_title": language = "lang=es" (without blankspaces). Default is English. |
place.pelagios |
character string to add to the search in Pelagios to limit the search just to place: place.pelagios = "types=place" |
bounding.box |
numeric character string to add to the search in GeoNames to restrict it to a geographic bounding box. It has to be enter in the following order "east, west, north, south" as a comma-separated list of decimal numbers: bounding.box = "43.7,-16.7,59.8,35.4" (~ Europe). |
bbox |
numeric character string to add to the search in Pelagios to restrict it to a geographic bounding box. It has to be enter in the following order "west, east, south, north" as a comma-separated list of decimal numbers: bbox = "-11.22,4.73,34.82,44.52" (~ Peninsular Spain). Different order as those of GeoNames! |
See Geonames at http://www.geonames.org; See Pelagios at http://commons.pelagios.org
If output
is "latlon" it returns a dataframe; If "all", a list.
Jose Luis Losada losadajoseluis@gmail.com, mostly reusing and directly based on the geocode function (ggmap) by David Kahle.
## Not run: georef("Rome"). The function is set as default with pelagios, so it is the same as georef("Rome", source = "pelagios"). georef(c("Rome", "Madrid", "Complutum")) places = c("Valladolid", "Madrid", "Rome") georef(places) georef(c("Rome", "Complutum"), place.pelagios = "types=place") georef(c("Valladolid", "Complutum"), source = "geonames", inject = "username=your_geonames_username") georef("Rome", source = "geowiki_all", inject = "username=your_geonames_username") georef("Rome", source = "geowiki_title", inject = "username=your_geonames_username") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.