extent {osdatahub} | R Documentation |
Create extents from geometries
Description
Provide extents from various types of input features and geometries to be used as filters in OS Data Hub API queries.
Usage
extent_from_bbox(bbox, crs = "crs84", returnType = c("qExtent", "geos", "wkt"))
extent_from_polygon(
polygon,
crs = "crs84",
returnType = c("qExtent", "geos", "wkt")
)
extent_from_geojson(
geojson,
crs = "crs84",
returnType = c("qExtent", "geos", "wkt")
)
extent_from_radius(
centre,
radius,
crs = "epsg:27700",
returnType = c("qExtent", "geos", "wkt")
)
extent_from_bng(grid_ref, returnType = c("qExtent", "geos", "wkt"))
Arguments
bbox |
A bounding box, passed as a numeric vector in (xmin, ymin, xmax,
ymax) or a |
crs |
(character or numeric) The identifier for coordinate reference system information for the feature, either in the format "epsg:xxxx" or an EPSG number. e.g. British National Grid can be supplied as "epsg:27700" or 27700. Available CRS values are: EPSG:27700, EPSG:4326, EPSG:7405, EPSG:3857, and CRS84. Defaults to CRS84. |
returnType |
(character) Define the object returned. The default is
|
polygon |
A polygon specified in a WKT string, an object of class
|
geojson |
A character string defining a polygon in GeoJSON format. |
centre |
Either a numeric vector with coordinates in the form (x, y), a
Point object in a WKT string, a Point as a |
radius |
(numeric) The radius of the circle in meters. |
grid_ref |
A character string with a British National Grid reference. The extent is formed by the grid square of the reference. |
Details
When defining an extent by a radius around a point, the CRS must be either 'epsg:27700' or 'epsg:3857' which implies the units of the distance for the radius are meters.
The qExtent
return option identifies a simple class of objects
containing a polygon of the extent in WKT format, the bounding box
coordinates, and a CRS string. It is intended to be used internally by
functions in osdatahub
.
Value
The coordinates of the polygon boundary as defined by
returnType
.
Examples
extent_from_bbox(c(600000, 310200, 600900, 310900), "epsg:27700", returnType = 'wkt')
extent_from_radius(c(441317, 112165), radius = 200)
extent_from_bng("SU3715")