Closed forkozi closed 3 years ago
There are many WKT strings out there that don't have a a corresponding EPSG code. The EPSG code is just a specific CRS that has been standardized.
Actually, that one works with pyproj:
>>> from pyproj import CRS
>>> cc = CRS('PROJCS["NAD83(2011) / UTM zone 18N",GEOGCS["NAD83(2011)",DATUM["NAD83_National_Spatial_Reference_System_2011",SPHEROID["GRS 1980",6378137,298.257222101004,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","1116"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-75],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","6347"]]')
>>> cc
<Projected CRS: EPSG:6347>
Name: NAD83(2011) / UTM zone 18N
Axis Info [cartesian]:
- [east]: Easting (metre)
- [north]: Northing (metre)
Area of Use:
- undefined
Coordinate Operation:
- name: UTM zone 18N
- method: Transverse Mercator
Datum: NAD83 (National Spatial Reference System 2011)
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
>>> cc.to_epsg()
6347
Works for me with rasterio:
>>> from rasterio.crs import CRS
>>> cc = CRS.from_wkt('PROJCS["NAD83(2011) / UTM zone 18N",GEOGCS["NAD83(2011)",DATUM["NAD83_National_Spatial_Reference_System_2011",SPHEROID["GRS 1980",6378137,298.257222101004,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","1116"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-75],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","6347"]]')
>>> cc.to_epsg()
6347
Ah, it is the second WKT:
>>> cc = pyproj.CRS('PROJCRS["NAD83(2011) / UTM zone 17N",BASEGEOGCRS["NAD83(2011)",DATUM["NAD83 (National Spatial Reference System 2011)",ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",6319]],CONVERSION["UTM zone 17N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",-81,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["meter",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["meter",1],ID["EPSG",8807]],ID["EPSG",16017]],CS[Cartesian,3],AXIS["x",east,ORDER[1],LENGTHUNIT["meter",1,ID["EPSG",9001]]],AXIS["y",north,ORDER[2],LENGTHUNIT["meter",1,ID["EPSG",9001]]],AXIS["up",up,ORDER[3],LENGTHUNIT["meter",1,ID["EPSG",9001]]]]')
>>> cc.to_epsg()
>>> cc.to_epsg(0)
6346
Terrific, thanks!
Issue: The following code returns
None
for some WKT strings (of common coordinate reference systems)This WKT string results in an EPSG code...:
This WKT string results in
None
:Does rasterio.crs support v2.0.6 of the OGC Geographic information — Well-known text representation of coordinate reference systems specifications (here)? Could it be the GEOGCS-versus-BASEGEOGCRS difference that's causing the issue?
Environment (
conda list
):Details about
conda
and system (conda info
):