query_nearest_names {osdatahub} | R Documentation |
Query the OS Names API
Description
Takes a pair of coordinates (X, Y) as an input to determine the closest name from a geographic directory of identifiable places.
Usage
query_nearest_names(
point,
radius = 100,
local_type,
key = get_os_key(),
returnType = c("geojson", "list", "sf"),
...
)
Arguments
point |
A set of British National Grid coordinates (EPSG:27700). Can be
a set of coordinates as a numeric vector, an object of class |
radius |
(numeric) The search radius in metres (max. 1000). Default is 100. |
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). |
Details
The OS Names API is a geographic directory containing basic information about identifiable places. Use this function to query Names to find the nearest named place to a given point location.
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.
Value
A GeoJSON string with the results of the API query, a list object,
or an object of class sf
based on the returnType
parameter.
See Also
Examples
# Named entity nearest to a point location
results <- query_nearest_names(point = c(440200,449300))