walkerke / crsuggest

Get appropriate CRS suggestions for your spatial data in R
Other
128 stars 7 forks source link

Find way to prioritize updated CRS #1

Closed walkerke closed 3 years ago

walkerke commented 4 years ago

Considering the following example:

library(tigris)
library(crsuggest)
options(tigris_use_cache = TRUE, tigris_class = "sf")

tx <- counties("TX", cb = TRUE)

suggest_top_crs(tx)

This gives us:

Using the projected CRS NAD83 / Texas State Mapping System which uses 'm' for measurement units. Please visit https://spatialreference.org/ref/epsg/3081/ for more information about this CRS.
[1] 3081

This is technically "correct" for the input GCS of NAD 1983 but the problem is that the Texas State Mapping System has been replaced by the Texas Centric Albers Equal Area & Lambert Conformal projected coordinate systems. The function as written won't pick this up as the Hausdorff distance between the input shapes and the EPSG polygons are identical for the older and newer coordinate systems.

Research if there is some way to figure this out and select the "current" CRS without hard-coding it (as there are likely other examples around the world that mirror this).