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

[BUG] CRS parser fails to parse urn:ogc:def:crs:OGC:1.3:CRS84 #521

Open
garychen2002 opened this issue Jan 22, 2024 · 1 comment
Open

[BUG] CRS parser fails to parse urn:ogc:def:crs:OGC:1.3:CRS84 #521

garychen2002 opened this issue Jan 22, 2024 · 1 comment
Labels

Comments

@garychen2002
Copy link

Describe the bug

I tried to load a geojson with the crs property name of urn:ogc:def:crs:OGC:1.3:CRS84 and it did not work.

To Reproduce

Steps to reproduce the behavior:

  1. create a geojson with the CRS property "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }
  2. load geojson as a json
  3. use Geometry.from_geojson to try to create a new Geometry object from the geojson

Expected behavior

The new object should be created successfully.

Environment

Python 3.11.5

Stack trace or screenshots
image

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10

Additional context

I believe the issue is related to this line where the CRS is parsed with a regex pattern:

crs_template = re.compile(r"urn:ogc:def:crs:.+::(?P<code>.+)", re.IGNORECASE)

crs_template = re.compile(r"urn:ogc:def:crs:.+::(?P<code>.+)", re.IGNORECASE)

The end of the pattern has two colons at +:: where there should only be one.

@zigaLuksic
Copy link
Collaborator

zigaLuksic commented Jan 23, 2024

HI @garychen2002, thanks for reporting.

It seems like the issue is a bit different, because (according to name schemes) both urn:ogc:def:crs:EPSG::3163 and urn:ogc:def:crs:OGC:1.3:CRS84 are valid CRS definitions. Parsing EPSG codes is easy and thus implemented by us, but it seems like we could catch some more cases by replacing :: with :.*: in the pattern.

But in any case, I'll mark this on our to-do list.

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

No branches or pull requests

2 participants