Skip to contents

Use the Wikipedia API geosearch API to get Wikipedia articles for a location. See https://www.mediawiki.org/wiki/Extension:GeoData for more information. Only returns Wikipedia articles with coordinates.

Usage

get_wiki_data(
  location,
  dist = 100,
  diag_ratio = NULL,
  asp = NULL,
  unit = "meter",
  radius = FALSE,
  primary = NULL,
  details = c("type", "name", "region"),
  lang = "en",
  limit = 50,
  geometry = TRUE
)

Arguments

location

sf object. If multiple areas are provided, they are unioned into a single sf object using sf::st_union

dist

buffer distance in units. Optional.

diag_ratio

ratio of diagonal distance of area's bounding box used as buffer distance. e.g. if the diagonal distance is 3000 meters and the "diag_ratio = 0.1" a 300 meter will be used. Ignored when dist is provided.

asp

Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric, get_asp() returns the same value without modification.

unit

Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"

radius

If TRUE, use dist as a buffer around the center of the location.

primary

If TRUE, search for primary coordinates. Set primary to "all" or "secondary" to search other coordinate types.

details

Additional detailed to return with results. Options include "type", "name", "country", "region"

lang

Language to search on Wikipedia; defaults to "en".

limit

Number of pages to return (max 500); deafaults to 50

geometry

If TRUE, return sf object. If FALSE, return dataframe. Defaults to FALSE.