check_projection {plotKML} | R Documentation |
Function parse_proj4
gets the proj4 string from a space-time object and check_projection
checks if the input projection is compatible with the referent projection system. The referent system is by default the longlat
projection with WGS84 datum (KML-compatible coordinates).
check_projection(obj, control = TRUE, ref_CRS = get("ref_CRS", envir = plotKML.opts))
obj |
object of class |
control |
logical; if TRUE, a logical value is returned, if FALSE, an error is thrown if the test failed |
ref_CRS |
the referent coordinate system. |
A cartographic projection is KML compatible if: (a) geographical coordinates are used, and (b) if they relate to the WGS84 ellispoid ("+proj=longlat +datum=WGS84"
). You can also set your own local referent projection system by specifiying plotKML.env(ref_CRS = ...)
.
obj
needs to have a proper proj4 string (CRS), otherwise check_projection
will not run. If the geodetic datum is defined via the +towgs
, consider converting the coordinates manually i.e. by using the spTransform
or reproject
method.
Pierre Roudier, Tomislav Hengl, and Dylan Beaudette
reproject
, rgdal::CRS-class
data(eberg) library(sp) library(rgdal) coordinates(eberg) <- ~X+Y proj4string(eberg) <- CRS("+init=epsg:31467") check_projection(eberg) # not yet ready for export to KML; parse_proj4(proj4string(eberg)) eberg.geo <- reproject(eberg) check_projection(eberg.geo) # ... now ready for export