1

I am trying to read a GML file using the following code:

import geopandas as gpd

G = gpd.read_file('extract/top10nl_gebouw.gml', driver='gml')

But the following error is raised:

---------------------------------------------------------------------------
CPLE_AppDefinedError                      Traceback (most recent call last)
Input In [4], in <cell line: 3>()
      1 import geopandas as gpd
----> 3 G = gpd.read_file('extract/top10nl_gebouw.gml', driver='gml')

File ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/io/file.py:253, in _read_file(filename, bbox, mask, rows, engine, **kwargs)
    250     path_or_bytes = filename
    252 if engine == "fiona":
--> 253     return _read_file_fiona(
    254         path_or_bytes, from_bytes, bbox=bbox, mask=mask, rows=rows, **kwargs
    255     )
    256 elif engine == "pyogrio":
    257     return _read_file_pyogrio(
    258         path_or_bytes, bbox=bbox, mask=mask, rows=rows, **kwargs
    259     )

File ~/opt/anaconda3/lib/python3.9/site-packages/geopandas/io/file.py:301, in _read_file_fiona(path_or_bytes, from_bytes, bbox, mask, rows, **kwargs)
    293 with fiona_env():
    294     with reader(path_or_bytes, **kwargs) as features:
    295 
    296         # In a future Fiona release the crs attribute of features will
    297         # no longer be a dict, but will behave like a dict. So this should
    298         # be forwards compatible
    299         crs = (
    300             features.crs["init"]
--> 301             if features.crs and "init" in features.crs
    302             else features.crs_wkt
    303         )
    305         # handle loading the bounding box
    306         if bbox is not None:

File ~/opt/anaconda3/lib/python3.9/site-packages/fiona/collection.py:215, in Collection.crs(self)
    213 """Returns a Proj4 string."""
    214 if self._crs is None and self.session:
--> 215     self._crs = self.session.get_crs()
    216 return self._crs

File fiona/ogrext.pyx:742, in fiona.ogrext.Session.get_crs()

File fiona/_err.pyx:291, in fiona._err.exc_wrap_pointer()

CPLE_AppDefinedError: Cannot import 28992 due to ALLOW_FILE_ACCESS=NO

I have tried installing and uninstalling different versions of GeoPandas and Fiona, but nothing seems to fix the issue. My colleague who runs the exact same code (with Fiona 1.8.6) is not experiencing any issues.

0 Answers0