This function performs operations on projected data.

geo_projected(shp, fun, crs, silent, ...)

Arguments

shp

A spatial object with a geographic (WGS84) coordinate system

fun

A function to perform on the projected object (e.g. the the rgeos or sf packages)

crs

An optional coordinate reference system (if not provided it is set automatically by geo_select_aeq())

silent

A binary value for printing the CRS details (default: TRUE)

...

Arguments to pass to fun, e.g. byid = TRUE if the function is rgeos::gLength()

Examples

lib_versions <- sf::sf_extSoftVersion()
lib_versions
#>           GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
#>        "3.8.0"        "3.0.4"        "6.3.1"         "true"         "true" 
#>           PROJ 
#>        "6.3.1" 
# fails on some systems (with early versions of PROJ)
if (lib_versions[3] >= "6.3.1") {
  shp <- routes_fast_sf[2:4, ]
  geo_projected(shp, sf::st_buffer, dist = 100)
}
#> Simple feature collection with 3 features and 16 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -1.552483 ymin: 53.81661 xmax: -1.511078 ymax: 53.83131
#> Geodetic CRS:  WGS 84
#>   plan start finish length time waypoint cum_hill change_elev dif_max_min
#> 2    1     1      1   1535  464       53       87          -7          39
#> 3    1     1      1   2976  829       97      112          -4          39
#> 4    1     1      1   2290  502       37      103         -45          65
#>   up_tot down_tot av_incline co2_saving calories busyness ID
#> 2     40       47 0.05667752        286       52     3327  2
#> 3     54       58 0.03763441        555       78     7062  3
#> 4     29       74 0.04497817        427       38     3380  4
#>                         geometry
#> 2 POLYGON ((-1.535639 53.8292...
#> 3 POLYGON ((-1.551653 53.8248...
#> 4 POLYGON ((-1.530458 53.8166...