latlon2epsg | R Documentation |
The 'latlon2epsg' function determines the appropriate UTM (Universal Transverse Mercator) EPSG code for a given 'sf' object based on its centroid's latitude and longitude. It then transforms the object to the identified coordinate reference system (CRS).
latlon2epsg(sf_obj)
sf_obj |
An 'sf' object representing spatial features. This object must have a valid CRS with latitude and longitude coordinates. |
The function calculates the geographic centroid of the input spatial object and determines its latitude and longitude. Based on the latitude:
The object is transformed to EPSG:3413 (North Pole).
The object is transformed to EPSG:3031 (South Pole).
The function calculates the UTM zone based on longitude and transforms the object to the appropriate UTM EPSG code (EPSG:326XX for the Northern Hemisphere, EPSG:327XX for the Southern Hemisphere).
An 'sf' object transformed to the appropriate UTM coordinate reference system.
The function requires that the input 'sf' object already has a valid CRS defined (e.g., WGS84).
[sf::st_transform()], [sf::st_centroid()], [sf::st_union()]
latlon2epsg(get_shapes_sf(for_bus_gtfs)$shapes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.