2

I have a feature class in a file geodatabase that I attempted to open with Geopandas, but I got the "list index out of range" error. To bypass this error, I'm reading the feature class directly with Fiona. This worked without a problem, and now I have a Fiona collection. What I can't figure out, is how to continue processing this file in Geopandas. I have been unable to find anything in the respective documentations about how to process an existing object.

I also submitted a bug issue at github/geopandas.

3

Found a solution by replicating the read_file() function in geopandas/file.py:

# Build the GeoDataFrame from Fiona Collection
gdf = gdp.GeoDataFrame.from_features([feature for feature in fiona_collection], crs=crs)
# Get the order of the fields in the Fiona Collection; add geometry to the end
columns = list(fiona_collection.meta["schema"]["properties"]) + ["geometry"]
# Re-order columns in the correct order
gdf = gdf[columns]

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.