The CRS view() draws in when crs is not given. The project is polar
first, and a view in the data's own CRS is preferred to a reprojection,
so the rule is:
Usage
view_crs(x, ...)
# S3 method for class 'matrix'
view_crs(x, ..., extent, crs)
# S3 method for class 'array'
view_crs(x, ..., extent, crs)Arguments
- x
Geometry 'wk' can handle or a data frame with such a column (an
sfobject, say), an Arrow stream or table (read once, here: see Arrow streams inview()), anOGRFeatureSet, a 'terra'SpatRasterorSpatVector, a 'stars' object orstars_proxy(view-stars), a string (WKT text, or the path, URL or data source name of a raster or vector source: see Strings inview()), a list of them, or a matrix or array withextentandcrs.- ...
Not used, except by the matrix and array methods.
- extent, crs
For a matrix or array, which has no CRS of its own: the grid's extent and CRS, as for view-matrix.
Value
A CRS for aobcore::scene(): an "authority:code" string such
as "EPSG:3031", or, when the data's CRS has no code, its WKT.
Details
A projected CRS is kept: the data are drawn in their own CRS.
Lon/lat data lying entirely south of 40S (the bounding box's northern edge at or below -40) are drawn in EPSG:3031, Antarctic Polar Stereographic. This covers Antarctica, the Southern Ocean south of the Subtropical Front, and circumpolar data such as a coastline south of 40S, all of which a lon/lat view tears apart at the pole.
Lon/lat data lying entirely north of 60N are drawn in EPSG:3413, NSIDC Sea Ice Polar Stereographic North. The northern threshold is stricter than the southern one because much mid-latitude land lies between 40N and 60N, where a polar view turns the map away from north-up; south of 40S there is little land other than Antarctica.
Other lon/lat data are drawn in their own lon/lat CRS, flat (plate carree), which the scene spec allows. Web Mercator is not used: it cannot show the poles, and a tiled Mercator basemap is a non-goal.
For a raster (a SpatRaster, a 'stars' object or proxy, read from its
dimensions alone) the bounding box is the grid's extent, so a lon/lat grid
from 90S to 40S, whose northern edge is at 40S, is drawn in EPSG:3031. A
matrix or array has no CRS of its own: view_crs(m, extent = , crs = )
applies the rule to the crs and extent given for it (see
view-matrix).
For a list of objects (see view-layers) the rule is applied once to the whole list: the CRS of the first object with a projected CRS is kept; when every object is in lon/lat, rules 2 to 4 apply to their combined latitude range, and rule 4 keeps the first object's CRS.
Data with no CRS is an error: set one first (for example
wk::wk_set_crs(), sf::st_set_crs() or terra::crs<-), or pass crs
to view(). Whether a CRS is lon/lat is read by 'PROJ'.
Examples
coast <- sf::st_read(system.file("extdata", "coastline_south_40s.geojson",
package = "aobcore"), quiet = TRUE)
view_crs(coast)
#> [1] "EPSG:3031"
nc <- sf::st_read(system.file("shape", "nc.shp", package = "sf"), quiet = TRUE)
view_crs(nc)
#> [1] "EPSG:4267"