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.

Incorrect `crs` set on fiona.open()

See original GitHub issue

Expected behavior and actual behavior.

I have a geodatabase I downloaded from this source (warning: fairly large attachment): https://pspsinfo.ss.pge.com/artifacts/wildfire-mitigation-data/Attachment-6-GIS-Files.zip

When I load one of the layers (Transformer) into QGIS, I see the CRS as EPSG:4430 and looks right on the map: image

When I used Fiona to load the layer, it is reading the crs as EPSG:26910 (or in fiona land as {'init': 'epsg:26910'})

Can I force Fiona to use another projected coordinate system while reading? Some kind of a set CRS method?

Can confirm that EPSG:26910 doesn’t geo reference it correctly.

Steps to reproduce the problem.

c = fiona.open('pge/pge/infrastructure/v1/pge_infrastructure/EDGIS_2-12/EDGIS2-12.gdb', layer='Transformer')
c.crs
> {'init': 'epsg:26910'}

Operating system

On a debian-based docker container with python 3.7

Fiona and GDAL version and provenance

1.8.13 using PyPi and GDAL 3.0.4 and PROJ 6.3.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rbuffatcommented, Apr 14, 2020

With Fiona installed with pip (arch linux) I get:

>>> c = fiona.open('EDGIS2-12.gdb', layer='Transformer')
>>> c.crs
{'init': 'epsg:4430'}
>>> fiona.__version__
'1.8.13.post1'

As far as I know fiona does not alter coordinates when reading. As long as you don’t use the CRS in your processing pipeline you should be fine.

1reaction
sgilliescommented, Apr 14, 2020

@koshy1123 this sounds related to https://github.com/OSGeo/PROJ/issues/2086 maybe?

There have been some unit and WKT issues in PROJ 6 recently. See also https://lists.osgeo.org/pipermail/gdal-dev/2020-January/051483.html and https://github.com/OSGeo/PROJ/pull/1863.

I’m not going to be able to download and inspect that zip file due to its size and the fact that I don’t build the file gdb driver.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fiona fails to write CRS to shapefile - GIS Stack Exchange
I had this issue, and fixed it by setting the GDAL_DATA variable correctly, so that fiona can map the projection strings correctly.
Read more >
1 The Fiona User Manual — Fiona 2.0dev documentation
Reading a GIS vector file begins by opening it in mode 'r' using Fiona's open() function. It returns an opened Collection object. > ......
Read more >
Fiona Documentation - Read the Docs
set include dirs, library dirs, and libraries options via the setup.cfg ... fiona.open() can now create new datasets using CRS URNs (#823).
Read more >
geopandas.read_file
With engine=”fiona”, CRS mis-matches are resolved if given a GeoSeries or ... the keyword arguments are passed to fiona.open() or fiona.collection.
Read more >
Fiona - PyPI
Note: The following environment variables needs to be set so that Fiona works correctly: ... fiona.open() can now create new datasets using CRS...
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