Fixes mis-specified coordinate reference system (CRS) with respect to the geospatial object's coordinate units. Ensures that the CRS matches the feature geometry units.

sf_fix_crs(obj)

Arguments

obj

sf object; The geospatial object to be corrected.

Value

the geospatial object with CRS correctly defined to match feature coordinate geometry.

Details

Geospatial features generated using the GeoJSON format often contain a CRS that does not match the feature geometry coordinate units. The GeoJSON format made the choice to not even try: [RFC 7946 - The GeoJSON Format](https://datatracker.ietf.org/doc/html/rfc7946#page-12).