get_geo_entity: Retrieve geographic information from Wikidata

Description Usage Arguments Value See Also Examples

Description

get_geo_entity retrieves the item ID, latitude and longitude of any object with geographic data associated with another object with geographic data (example: all the locations around/near/associated with a city).

Usage

1
get_geo_entity(entity, language = "en", radius = NULL, ...)

Arguments

entity

a Wikidata item (Q...) or series of items, to check for associated geo-tagged items.

language

the two-letter language code to use for the name of the item. "en" by default, because we're imperialist anglocentric westerners.

radius

optionally, a radius (in kilometers) around entity to restrict the search to.

...

further arguments to pass to httr's GET.

Value

a data.frame of 5 columns:

See Also

get_geo_box for using a bounding box rather than an unrestricted search or simple radius.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# All entities
sf_locations <- get_geo_entity("Q62")

# Entities with French, rather than English, names
sf_locations <- get_geo_entity("Q62", language = "fr")

# Entities within 1km
sf_close_locations <- get_geo_entity("Q62", radius = 1)

# Multiple entities
multi_entity <- get_geo_entity(entity = c("Q62", "Q64"))

Ironholds/WikidataR documentation built on May 7, 2019, 6:38 a.m.