Toblerity / Fiona

Fiona reads and writes geographic data files
https://fiona.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.16k stars 203 forks source link

Problems Writing to FileGDB format with fio-load #299

Closed micahcochran closed 8 years ago

micahcochran commented 8 years ago

I'm trying to use fio to convert a shapefile into a FileGDB. FileGDB is a multilayer format. These examples are really only treatingthe format as a single layer format. That is so that I can try to figure out what is going wrong.

This example seems to work

import fiona

with fiona.drivers():
    with fiona.open('tests/data/coutwildrnp.shp') as source:
        meta = source.meta
        meta['driver'] = 'FileGDB'
        meta['layer'] = 'layername'

        with fiona.open('out.gdb', 'w', **meta) as sink:
            for f in source:
                sink.write(f)

GDAL/OGR does it this way:

C:\...>ogr2ogr try1.gdb coutwildrnp.shp -f FileGDB

Slap -nln layername on the end to rename the layer to 'layername'.

So I tried this:

C:\...>fio dump coutwildrnp.shp | fio load try2.gdb --driver FileGDB
WARNING:Fiona:CPLE_AppDefined in Empty Spatial Reference

That crashes python on windows. :-(

My first guess was this. I looked in the source, but I didn't find a "layer" option.

C:\...>fio dump coutwildrnp.shp | fio load try3.gdb --driver FileGDB --layer layername
Error: no such option: --layer

This doesn't cause a crash, but I'm guessing this never gets to GDAL/OGR due to the bad command line argument.

This was the other way I thought this could work. (ArcGIS Desktop treats it GeoDatabases like directories in ArcCatalog.)

C:\...>fio dump coutwildrnp.shp | fio load try3.gdb/layername --driver FileGDB
ERROR:Fiona:CPLE_AppDefined in FGDB data source name must use 'gdb' extension.

Yet again, it crashes python on windows. :-( The same thing happens if I omit the .gdb extension.

My problem is I can't get fio to write to FileGDB format. Is it just me? Is it my installation? Is this something needing to be patched?

sgillies commented 8 years ago

Definitely a bug, @micahcochran. I failed to add multi-layer support to fio-load. Sorry! Fix coming soon.

smnorris commented 8 years ago

It looks like there is no multi-layer support for fio info either?

geowurster commented 8 years ago

@smnorris Yep - lets track that in https://github.com/Toblerity/Fiona/issues/316