Hello everyone,
I am trying to read a vector file stored in a GRASS database from geopandas-fiona.
import fiona
import geopandas as gpd
fiona.supported_drivers[“OGR_GRASS”] = “r”
gdf = gpd.read_file(‘/mnt/d/Datos_Landsat/nc_basic_spm_grass7/PERMANENT/vector/roadsmajor/head’)
However it seems that fiona support for GRASS data is not enabled by default. And the suggested activation does not work. I get the following error
Traceback (most recent call last):
File “fiona/_shim.pyx”, line 73, in fiona._shim.gdal_open_vector
File “fiona/_err.pyx”, line 270, in fiona._err.exc_wrap_pointer
fiona._err.CPLE_OpenFailedError: ‘/mnt/d/Datos_Landsat/nc_basic_spm_grass7/PERMANENT/vector/roadsmajor/head’ not recognized as a supported file format.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 1, in
File “/home/juan/miniconda3/envs/iota2-env/lib/python3.6/site-packages/geopandas/io/file.py”, line 76, in read_file
with reader(path_or_bytes, **kwargs) as features:
File “/home/juan/miniconda3/envs/iota2-env/lib/python3.6/site-packages/fiona/env.py”, line 397, in wrapper
return f(*args, **kwargs)
File “/home/juan/miniconda3/envs/iota2-env/lib/python3.6/site-packages/fiona/init.py”, line 253, in open
layer=layer, enabled_drivers=enabled_drivers, **kwargs)
File “/home/juan/miniconda3/envs/iota2-env/lib/python3.6/site-packages/fiona/collection.py”, line 159, in init
self.session.start(self, **kwargs)
File “fiona/ogrext.pyx”, line 484, in fiona.ogrext.Session.start
File “fiona/_shim.pyx”, line 80, in fiona._shim.gdal_open_vector
fiona.errors.DriverError: ‘/mnt/d/Datos_Landsat/nc_basic_spm_grass7/PERMANENT/vector/roadsmajor/head’ not recognized as a supported file format.
I think it is possible that the OGR build does not include the driver to read GRASS GIS data, but this is new ground for me. does anyone have experience with this integration?
I am running on a WSL2 and on a conda environment created with the following packages:
- https://anaconda.org/iota2/grass (grass7.7)
- https://anaconda.org/iota2/otb (Orfeo Toolbox 7.1)
Regards,
Juan