question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CRS Axis Order issues with 1.8.9

See original GitHub issue

Problem Description

When reading in: https://raw.githubusercontent.com/geopandas/geopandas/master/geopandas/tests/data/overlay/overlap/df1_df2_overlap-union.geojson

With previous versions of Fiona, the WKT string was read in as:

GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]

However, currently (1.8.9) it is read in as:

GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Longitude",EAST],AXIS["Latitude",NORTH]]

Everything is mostly the same except for the axis order at the end.

I believe this is due to this line: https://github.com/Toblerity/Fiona/blob/960568d2fede452a042e5c9f315fb93e3cd56baa/fiona/_crs.pyx#L65

This is problematic for a couple of reasons:

  1. It does not preserve the original WKT string/projection and mangles it
  2. What if the user actually modified their data to be in the axis order mentioned in the WKT string? How would they tell Fiona that they did so?

Recommended Solution

Add an always_xy flag to crs_to_wkt() and only use it when creating a CRS to be used in the transformation. It would also be a good idea to add an always_xy flag to the transformation operations for the case where the user modified the underlying data to match the axis order specified in the CRS. For Fiona 1.8.x, the always_xy flag could be omitted from the transformation operations and just default to always_xy=True in crs_to_wkt()

Thoughts?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:27 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
snowman2commented, Nov 20, 2019

@snowman2 thanks for opening that issue!

Not a problem! Looks like EPSG:4326 is the winner in this scenario and the fix is in GDAL, so no change needed in Fiona.

1reaction
jorisvandenbosschecommented, Nov 20, 2019

the GeoJSON spec, RFC 7946, says the CRS is the OGC’s CRS84 (which is explicitly long/lat order). FIona shouldn’t go against that.

Well, Fiona (or GDAL) does go against it. When you use RFC7946="YES", you actually get back EPSG:4326 … It’s only when not using the new spec that you get back CRS84 (well, you get back what is written into the “crs” field of the geojson file, but it is impossible to write EPSG:4326 in that field, as it always get converted to CRS84)

Read more comments on GitHub >

github_iconTop Results From Across the Web

WMS axis ordering depending on CRS a 2.0 rollout stopper ...
The move in wms 1.3.0 to a more strict axis ordering and a changed behaviour from qgis 1.8 to 2.0 is turning into...
Read more >
Where do I find CRS axis names? - GIS Stack Exchange
If you just want to see the axis order with your eyes it is easiest to make a text search with "3857" at...
Read more >
[1.8.9] Minecraft is all choppy especially on servers, fps ...
Have an issue/problem with Minecraft? We're the sub for you! ... [1.8.9] Minecraft is all choppy especially on servers, fps around 90-200.
Read more >
Change Log — pyproj 3.2.1 documentation - GitHub Pages
BUG: Fix pickling for CRS builder classes (issue #897) ... CRS.axis_info to pull all relevant axis information from CRS (issue #557).
Read more >
Fiona Documentation - Read the Docs
Axis ordering for results of fiona.transform was wrong when CRS were ... The 1.8.9.post1 release introduced a bug affecting builds of the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found