GeoFrame.CRS (GeoFrame v0.3.4)

Copy Markdown View Source

Helpers on CRS strings ("EPSG:<code>", "OGC:CRS84").

Summary

Functions

Whether two CRS labels are compatible for binary operations, joins, overlays and concat.

Whether crs names a geographic (lon/lat) CRS.

Functions

equivalent?(a, b)

@spec equivalent?(String.t() | nil, String.t() | nil) :: boolean()

Whether two CRS labels are compatible for binary operations, joins, overlays and concat.

The comparison ignores case and treats OGC:CRS84 as EPSG:4326 (GeoFrame is always longitude/latitude). Labels are never rewritten. Two nil CRSs are equivalent; nil against a CRS is not (operations that let an unset CRS match anything handle nil themselves).

iex> GeoFrame.CRS.equivalent?("epsg:4326", "OGC:CRS84")
true
iex> GeoFrame.CRS.equivalent?("EPSG:4326", "EPSG:3857")
false

geographic?(crs)

@spec geographic?(String.t() | nil) :: boolean() | nil

Whether crs names a geographic (lon/lat) CRS.

Returns true for OGC:CRS84, EPSG:4326 and any EPSG code whose definition is +proj=longlat, false for projected CRSs, and nil for nil or a CRS that cannot be resolved.

iex> GeoFrame.CRS.geographic?("EPSG:4326")
true
iex> GeoFrame.CRS.geographic?("EPSG:3857")
false
iex> GeoFrame.CRS.geographic?(nil)
nil