geopandas / pyogrio

Vectorized vector I/O using OGR
https://pyogrio.readthedocs.io
MIT License
257 stars 22 forks source link

Add Dataset, Domain, and Relationship Info in Pyogrio #406

Open Youssef-Harby opened 2 months ago

Youssef-Harby commented 2 months ago

Hello Pyogrio Team,

I'm using pyogrio for working with ESRI FileGDB files and found a couple of features that could be improved:

  1. Datasets in List Layers: The list_layers function only shows layers, not the datasets holding them. In ogrinfo, you can see both layers and their datasets. It would be helpful if pyogrio could also show this information to better understand how data is organized.

  2. Access to Domains and Relationships: I also noticed that pyogrio.read_info doesn’t show domains and relationships. These are important for knowing how data is connected and its rules. ogrinfo can show this with a command like this:

    ogrinfo -ro -al -json -so input.gdb > output.json

    Here’s a short version of what ogrinfo outputs in output.json:

    
    {
    "description": "input-gdb",
    "driverShortName": "OpenFileGDB",
    "driverLongName": "ESRI FileGDB",
    "layers": [...],
    "metadata": 1,
    "domains": {...},
    "rootGroup": {
    "layerNames": [...],
    "groups": [...],
    },
    "relationships": {...}
    }
brendan-ward commented 2 months ago

Thanks for the suggestion; handling of advanced driver specific properties like domains / relationships could be improved.

Can you point us to a small, publicly accessible FileGDB file that has domains / relationships set, or instructions on how to use ogr2ogr to create them from an existing dataset?

I don't understand what you mean by showing datasets in the context of listing layers; since the dataset is input to the list_layers function, there is only the one, right? Can you give us more of an example where listing layers would be showing layers from multiple datasets?

rouault commented 1 month ago

publicly accessible FileGDB file that has domains / relationships set

https://github.com/OSGeo/gdal/tree/master/autotest/ogr/data/filegdb/Domains.gdb https://github.com/OSGeo/gdal/tree/master/autotest/ogr/data/filegdb/relationships.gdb

I don't understand what you mean by showing datasets

They meant "feature datasets" which is a Esri FileGeodatabase specifc terminology to designate a sort of group of layers.

Cf https://github.com/OSGeo/gdal/tree/master/autotest/ogr/data/filegdb/featuredataset.gdb

brendan-ward commented 1 month ago

Thanks for the example datasets @rouault !