I’m having trouble obtaining crs values for geodatabase feature classes in fiona (version 1.7.5). Specifically, the crs attribute returns empty for many of the geodatabases I try to read. This is not an isolated incident -- it occurs frequently with OpenFileGeodatabase types.

For example...

$ fio info --indent 2 /Users/felix/Data/VilasTransportation.gdb
/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
  return f(*args, **kwds)
  "driver": "OpenFileGDB",
  "schema": {
    "properties": {
      "Name": "str:100",
      "NameAlt": "str:100",
      "Type": "str:20",
      "Ownership": "str:30",
      "Municipality": "str:20",
      "Source": "str:30",
      "Comment": "str:250",
      "EditDate": "datetime",
      "Editor": "str:5",
      "SHAPE_Length": "float"
    "geometry": "MultiLineString"
  "crs": "",
  "crs_wkt": "PROJCS[\"NAD_1983_HARN_WISCRS_Vilas_County_Feet\",GEOGCS[\"GCS_North_American_1983_HARN\",DATUM[\"NAD83_High_Accuracy_Reference_Network\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4269\"]],PROJECTION[\"Lambert_Conformal_Conic_1SP\"],PARAMETER[\"False_Easting\",441000.0],PARAMETER[\"False_Northing\",165147.666],PARAMETER[\"Central_Meridian\",-89.48888888888889],PARAMETER[\"Scale_Factor\",1.0000730142],PARAMETER[\"Latitude_Of_Origin\",46.07784409055556],UNIT[\"Foot_US\",0.3048006096012192],AUTHORITY[\"Esri\",\"103463\"]]",
  "bounds": [
  "name": "TransportationLines",
  "count": 3946

As demonstrated below, GDAL has no problem generating a proj4 string for the same dataset.

$ gdalsrsinfo /Users/felix/Data/VilasTransportation.gdb

PROJ.4 : '+proj=lcc +lat_1=46.07784409055556 +lat_0=46.07784409055556 +lon_0=-89.48888888888889 +k_0=1.0000730142 +x_0=134417.0688341377 +y_0=50337.10927101854 +ellps=GRS80 +units=us-ft +no_defs '


I need proj4 parameters to use in a pyproj.Proj() instance, so simply grabbing the fiona.crs_wkt value doesn’t solve my issue. Similarly, I want to avoid conversions between proj4 and wkt formats with ogr/osr, or parsing the wkt for parameters.

Why does fiona miss the crs info, but GDAL doesn't? Is it possible to obtain proj4 parameters in fiona with the same consistency as GDAL command line?

The gdb example can be downloaded here (transportation layer) --> http://vcgis.co.vilas.wi.us/vcom/Download.html


Afraid I don't have a GDB to test this on, so your mileage may vary :-/ Also using Fiona 1.7.5, and pyproj

I tried saving a layer from QGIS using a totally bespoke CRS (Orthographic, so the proj4 string would not correspond to an EPSG code, and would force Fiona to try to get the proj4 parameters instead)

I saved it as

  • a geoJSON file
  • a shapefile

In the case of geoJSON, source.crs gave me

{'init': 'epsg:4326'}

which is usable as a pyproj initialisation string (even if the projection is wrong)

In the case of the shapefile, it did break things out into a dictionary of proj4 parameters...

{'y_0': 0, 'proj': 'ortho', 'ellps': 'WGS84', 'lon_0': 105.423, 'x_0': 0, 'no_defs': True, 'units': 'm', 'lat_0': -6.102}

So although Fiona's .crs should split out the proj4 parameters, this may not work with all drivers. I see your CRS authority is ESRI, so it's possible the driver isn't able to look it up and gives up (but the shapefile driver doesn't). If you can find an equivalent EPSG code which matches your projection, that might help.

This issue on the Fiona Github looks as if it might be related.


I see the same thing with your dataset. If you need to do this from Python and gdalsrsinfo works, you could always use subprocess to run gdalsrsinfo against your gdb file, and extract the line with the proj.4 string from the output. Hacky, I admit, but it would work..

import subprocess
subprocess.check_output(["gdalsrsinfo", "-o", "proj4", "/path/to.gdb"])
|improve this answer|||||
  • Thanks Steven. The two examples you give would work great in pyproj.Proj(). However, in this case, source.crs is giving me {}, which would throw a RuntimeError: projection not named if I tried to initialize with this NoneType value. Fiona 1.7.5 tends to open my geodatabases with the "OpenFileGDB" driver. In most cases, retrieving the .crs attribute gives me an acceptable output to plug into pyproj, but other times, such as in this case, I get nothing. I edited this post to include the gdb example and a more detailed view of the resulting collection when opening the gdb with fiona. – Jess Apr 6 '17 at 2:57
  • thanks for the clarifications/edits. I see the same thing. You could try answers to this question to see if there's a way to get from the OGC WKT representation (which you do get) to a proj4 string – Steven Kay Apr 6 '17 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.