in data/geospatial/crs-gen.py [0:0]
def write_crs_files():
# Create the Shapely geometry
geometry = shapely.from_wkt(WYOMING_HIRES)
# A general purpose coordinate system for the United States
crs_not_lonlat = pyproj.CRS("EPSG:5070")
transformer = pyproj.Transformer.from_crs(
"OGC:CRS84", crs_not_lonlat, always_xy=True
)
geometry_not_lonlat = shapely.transform(
geometry, transformer.transform, interleaved=False
)
# Write with the default CRS (i.e., lon/lat)
write_crs(WkbType(), geometry, "crs-default.parquet")
# Write a Geography column with the default CRS
write_crs(
WkbType(edges="spherical"),
geometry,
"crs-geography.parquet",
col_name="geography",
)
# Write a file with the projjson format in the specification
# and the appropriate metadata key
write_crs(
WkbType(crs="projjson:projjson_epsg_5070"),
geometry_not_lonlat,
"crs-projjson.parquet",
metadata={"projjson_epsg_5070": crs_not_lonlat.to_json()},
)
# Write a file with the srid format in the specification
write_crs(WkbType(crs="srid:5070"), geometry_not_lonlat, "crs-srid.parquet")
# Write a file with an arbitrary value (theoretically allowed by the format
# and consumers may choose to error or attempt to interpret the value)
write_crs(
WkbType(crs=crs_not_lonlat.to_json_dict()),
geometry_not_lonlat,
"crs-arbitrary-value.parquet",
)