Serialization Formats
CRS definitions need to be stored in files, exchanged between systems, and embedded in geospatial data formats. proj4rb can serialize any PjObject subclass to three standard formats: WKT (the OGC standard text format), PROJJSON (a JSON encoding), and classic PROJ strings.
# Create a CRS object we can serialize into multiple text formats.
crs = Proj::Crs.new('EPSG:4326')
# WKT representation (single-line for compact output).
puts crs.to_wkt(:PJ_WKT2_2019, multiline: false)
# PROJJSON representation.
puts crs.to_json(multiline: false)
# Classic PROJ string representation.
puts crs.to_proj_string