Project a lat/long bounding box to a generic projected coordinate system
Source:R/spatial-utils.R
spatial_helpers.Rd
Project a lat/long bounding box to a generic projected coordinate system
Convert an object to wkt.
Usage
bbox_to_projected(
x,
proj = c("laea", "aeqd", "utm", "pconic", "eqdc"),
ellps = "WGS84",
no_defs = TRUE,
opts = ""
)
to_wkt(x)
# Default S3 method
to_wkt(x)
# S3 method for class 'numeric'
to_wkt(x)
# S3 method for class 'character'
to_wkt(x)
Arguments
- x
The object to convert to wkt.
- proj
a character vector. The projection to use. One of "laea", "aeqd", "utm", "pconic", or "eqdc".
- ellps
a character vector. The ellipsoid to use. Select from
sf_proj_info(type = "ellps")
.- no_defs
a logical. Whether to include the +no_defs option in the proj string.
- opts
a character vector. Additional proj options to pass to the proj string. see details for more information.
Value
a numeric vector of length 4 representing the projected bounding box in the new coordinate system. Attributes include the new proj4 and wkt string.
A character string of the object in wkt format.
Details
For further info about the available "generic" projects see: for utm: https://proj.org/en/9.4/operations/projections/utm.html for laea: https://proj.org/en/9.4/operations/projections/laea.html for aeqd: https://proj.org/en/9.4/operations/projections/aeqd.html for pconic: https://proj.org/en/9.4/operations/projections/pconic.html for eqdc: https://proj.org/en/9.4/operations/projections/eqdc.html
Examples
bbox <- gdalraster::bbox_from_wkt(
wkt = wk::wkt("POINT (144.3 -7.6)"),
extend_x = 0.17,
extend_y = 0.125
)
bbox_to_projected(bbox)
#> [1] -18764.54 -13827.92 18764.54 13820.53
#> attr(,"proj4")
#> +proj=laea +lon_0=144.3 +lat_0=-7.6 +ellps=WGS84 +no_defs
#> attr(,"wkt")
#> [1] "PROJCS[\"unknown\",GEOGCS[\"unknown\",DATUM[\"Unknown based on WGS 84 ellipsoid\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]]],PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],PARAMETER[\"latitude_of_center\",-7.6],PARAMETER[\"longitude_of_center\",144.3],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH]]"