Perform GIS functions on a temporary, projected version of a spatial object
gprojected(shp, fun, crs = crs_select_aeq(shp), ...)
| shp | A spatial object with a geographic (WGS84) coordinate system |
|---|---|
| fun | A function to perform on the projected object (e.g. |
| crs | An optional coordinate reference system (if not provided it is set
automatically by |
| ... | Arguments to pass to |
# Find the length of routes that are in lat/long format data(routes_fast) rlength = gprojected(routes_fast, fun = rgeos::gLength, byid = TRUE)#>#>plot(routes_fast$length, rlength)cor(routes_fast$length, rlength)#> [1] NArbuf = gprojected(routes_fast, rgeos::gBuffer, byid = TRUE, width = 100)#>#>plot(rbuf)raster::crs(rbuf)#> CRS arguments: #> +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 #> +towgs84=0,0,0plot(routes_fast, col = "green", add = TRUE)