I'm building a Shiny app that color-codes GPX track logs based on the local slope at each point.
It's based extensively on https://rpubs.com/chrisbrunsdon/hiking
To calculate the "run" part of slope = rise/rune, I'm converting from latitude/longitude data into a X,Y grid (in meters) with sf::st_transform. One of the arguments for that function is crs
, or "coordinate reference system".
Up to now, I've been testing with GPX files I gathered near my home in southeastern Pennsylvania, so I've been using EPSG:2272 as my CRS.
To make this useful to anyone with logs form anywhere in the world, I'd like to auto-detect the most appropriate CRS based on the centroid of the points in the plotted track. Is there some canned function for doing that?