top: Selection of Toponyms

View source: R/top.R

topR Documentation

Selection of Toponyms

Description

This function returns coordinates of selected toponyms (strings).

Usage

top(strings, countries, ...)

Arguments

strings

character string vector with regular expressions to filter data.

countries

character string vector with country designations (names or ISO-codes).

...

Additional parameters:

  • feat.class character string vector. Selects data only of those feature classes (check http://download.geonames.org/export/dump/readme.txt for the list of all feature classes). By default, it is P.

  • polygon data frame. Selects toponyms only inside the polygon.

  • column character string vector. Selects the column(s) for query.

  • toponym_path character string. Path name for downloaded data.

Details

This function selects locations which match the regular expression from strings. Parameter countries accepts all designations found in country(query = "country table"). Polygons passed through the polygon parameter need to intersect or be within a country specified by the countries parameter. Parameter toponym_path accepts "pkgdir" for the package directory or a full, alternative path. With toponymOptions(), users can specify the path for toponym and map data downloaded by this package across sessions. See help(toponymOptions). The data used is downloaded by getData() and is accessible on the GeoNames download server.

Value

A data frame of selected toponym(s).

Examples

## We recommend setting a persistent path for downloaded data by using toponymOptions()
## Users can always set the path manually when a function is used
## For illustration purposes,
## 1. the path is manually set each time
## 2. and wrapped in donttest because data will be downloaded in the following examples:

itz_data <- top("itz$", "DE", toponym_path = tempdir())
# returns a data frame with all populated places
# in Germany ending in "itz"



vlad_data <- top("^Vlad", "RU", toponym_path = tempdir())
# returns a data frame with all populated places
# in Russia starting with "Vlad" (case sensitive)



itz_ice_data <- top(c("itz$", "ice$"), c("DE", "PL"), toponym_path = tempdir())
# returns a data frame with all populated places
# in Germany and Poland ending in either "itz" or "ice"



maw_data <- top("Maw$", "MM", column = "alternatenames", toponym_path = tempdir())
# returns a data frame with all populated places
# in Myanmar listed in the "alternatenames" column
# and ending in "Maw" (case sensitive)


toponym documentation built on April 13, 2026, 5:06 p.m.