Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://www.opengis.net/def/crs/EPSG/0/2193 is not a valid URI #60

Closed
vincentsarago opened this issue Aug 20, 2021 · 3 comments · Fixed by #61
Closed

https://www.opengis.net/def/crs/EPSG/0/2193 is not a valid URI #60

vincentsarago opened this issue Aug 20, 2021 · 3 comments · Fixed by #61

Comments

@vincentsarago
Copy link
Member

"supportedCRS": "https://www.opengis.net/def/crs/EPSG/0/2193",

from pyproj import CRS
CRS.from_user_input("https://www.opengis.net/def/crs/EPSG/0/2193")
>>> CRSError: Invalid projection: https://www.opengis.net/def/crs/EPSG/0/2193: (Internal Proj Error: proj_create: crs not found)

# Works with rasterio + GDAL 3
import rasterio
rasterio.crs.CRS.from_user_input("https://www.opengis.net/def/crs/EPSG/0/2193")
>>> CRS.from_epsg(2193)


# Fails with GDAL 2 (rasterio==1.1.8)
CRS.from_user_input('https://www.opengis.net/def/crs/EPSG/0/2193')
Traceback (most recent call last):
  File "rasterio/_crs.pyx", line 428, in rasterio._crs._CRS.from_user_input
  File "rasterio/_err.pyx", line 202, in rasterio._err.exc_wrap_ogrerr
rasterio._err.CPLE_BaseError: OGR Error code 5

cc @blacha

@vincentsarago
Copy link
Member Author

FYI we fixed this in #61 by replacing the URI by urn:ogc:def:crs:EPSG:2193.

import rasterio
rasterio.crs.CRS.from_string("urn:ogc:def:crs:EPSG:2193") == rasterio.crs.CRS.from_user_input("https://www.opengis.net/def/crs/EPSG/0/2193")
>>> True

@vincentsarago vincentsarago reopened this Aug 20, 2021
@vincentsarago
Copy link
Member Author

vincentsarago commented Aug 20, 2021

Well it should have been "urn:ogc:def:crs:EPSG::2193" not "urn:ogc:def:crs:EPSG:2193" 🤦

FYI it works with rasterio but not with pyproj

import pyproj
import rasterio

rasterio.crs.CRS.from_string("urn:ogc:def:crs:EPSG:2193")
>>> CRS.from_epsg(2193)

pyproj.CRS.from_user_input("urn:ogc:def:crs:EPSG:2193")
>>> CRSError: Invalid projection: urn:ogc:def:crs:EPSG:2193: (Internal Proj Error: proj_create: unrecognized format / unknown name)

rasterio.crs.CRS.from_string("urn:ogc:def:crs:EPSG::2193")
>>> CRS.from_epsg(2193)

pyproj.CRS.from_user_input("urn:ogc:def:crs:EPSG::2193")
>>>
<Projected CRS: EPSG:2193>
Name: NZGD2000 / New Zealand Transverse Mercator 2000
Axis Info [cartesian]:
- N[north]: Northing (metre)
- E[east]: Easting (metre)
Area of Use:
- name: New Zealand - North Island, South Island, Stewart Island - onshore.
- bounds: (166.37, -47.33, 178.63, -34.1)
Coordinate Operation:
- name: New Zealand Transverse Mercator 2000
- method: Transverse Mercator
Datum: New Zealand Geodetic Datum 2000
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

@blacha
Copy link
Contributor

blacha commented Aug 21, 2021

Interesting, so GDAL only added support for https uris in 3.0, we do not use much (any?) gdal v2 any more so havent noticed this issue.

We took these from the OGC doc https://docs.opengeospatial.org/is/17-083r2/17-083r2.html when we imported the WebMercatorQuad TMS, then when making this TMS we just used that standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants