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": [
298925.8670191318,
83800.42979672551,
583149.6328880489,
246478.92202439904
],
"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 '
OGC 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]],
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"]]
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
source.crsis giving me{}, which would throw aRuntimeError: projection not namedif 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 06 '17 at 02:57