query_names | R Documentation |
Retrieve information from a geographic directory of identifiable places based on a free text search.
query_names(
x,
limit = 100,
bounds,
bbox_filter,
local_type,
key = get_os_key(),
returnType = c("geojson", "list", "sf"),
...
)
x |
The free text search parameter. |
limit |
(numeric) The maximum number of features to return. Default is 100. |
bounds |
Biases the search results to a certain area. Should be of type
|
bbox_filter |
Filters the results to a certain area. Should be of type
|
local_type |
(character) Filters the results to certain local types. The available local types can be found at: https://osdatahub.os.uk/docs/names/technicalSpecification. |
key |
(character) OS API key. Default action is to search for an
environment variable using |
returnType |
(character) Return the query results as the raw
|
... |
Additional parameters (not currently used). |
The OS Names API is a geographic directory containing basic information about identifiable places. Those places are divided into themes, but the name of the place is the key property used in queries. The free text search is intended to be a "fuzzy" search.
Within OS Names, place names aren’t unique. Extra location details are provided to help users refine their queries and accurately identify the named place they’re interested in. These details include postcode district, populated place, district/borough, county/unitary authority, European region and country. Queries can also be refined by supplying bounding boxes or local types to search.
Technical details on the Names API are documented on the Data Hub: https://osdatahub.os.uk/docs/names/technicalSpecification.
A GeoJSON string with the results of the API query, a list object,
or an object of class sf
based on the returnType
parameter.
query_nearest_names()
, extent
# Find names places by text search.
results <- query_names('Buckingham Palace', limit = 5)
# Use filters
results <- query_names('Southampton', local_type = 'City')
# Limit results to a bounding box
extent <- extent_from_bbox(c(600000, 310200, 600900, 310900),
crs = 'EPSG:27700')
results <- query_names('Norwich', bbox_filter = extent)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.