This function takes a spatial object with a geographic (WGS84) CRS and returns a custom projected CRS focussed on the centroid of the object. This function is especially useful for using units of metres in all directions for data collected anywhere in the world.

geo_select_aeq(shp)

Arguments

shp

A spatial object with a geographic (WGS84) coordinate system

Details

The function is based on this stackexchange answer: https://gis.stackexchange.com/questions/121489

Examples

sp::bbox(routes_fast)
#> min max #> x -1.550807 -1.511861 #> y 53.804098 53.828874
new_crs <- geo_select_aeq(routes_fast) rf_projected <- sp::spTransform(routes_fast, new_crs) sp::bbox(rf_projected)
#> min max #> x -1545.979 1086.642 #> y -1833.567 1275.756
line_length <- rgeos::gLength(rf_projected, byid = TRUE) plot(line_length, rf_projected$length)
shp <- zones_sf geo_select_aeq(shp)
#> Coordinate Reference System: #> User input: +proj=aeqd +lat_0=53.8183052800959 +lon_0=-1.53014431833907 +x_0=0 +y_0=0 #> wkt: #> PROJCRS["unknown", #> BASEGEOGCRS["unknown", #> DATUM["World Geodetic System 1984", #> ELLIPSOID["WGS 84",6378137,298.257223563, #> LENGTHUNIT["metre",1]], #> ID["EPSG",6326]], #> PRIMEM["Greenwich",0, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8901]]], #> CONVERSION["unknown", #> METHOD["Modified Azimuthal Equidistant", #> ID["EPSG",9832]], #> PARAMETER["Latitude of natural origin",53.8183052800959, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8801]], #> PARAMETER["Longitude of natural origin",-1.53014431833907, #> ANGLEUNIT["degree",0.0174532925199433], #> ID["EPSG",8802]], #> PARAMETER["False easting",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8806]], #> PARAMETER["False northing",0, #> LENGTHUNIT["metre",1], #> ID["EPSG",8807]]], #> CS[Cartesian,2], #> AXIS["(E)",east, #> ORDER[1], #> LENGTHUNIT["metre",1, #> ID["EPSG",9001]]], #> AXIS["(N)",north, #> ORDER[2], #> LENGTHUNIT["metre",1, #> ID["EPSG",9001]]]]