Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to read an online zipped ESRI GDB file with Fiona 1.8.22, but success with Fiona 1.8.13 #1167

Closed
UrbanGISer opened this issue Dec 5, 2022 · 7 comments
Assignees

Comments

@UrbanGISer
Copy link

I expected to read an online zipped ESRI GDB file with Fiona 1.8.22, it failed, while when I try it in another environment with Fiona 1.8.13, it succeeded.

Steps to reproduce the problem.

import fiona
import geopandas as gp
path="https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip"
c = fiona.open(path,layer=0)
gdf = gp.GeoDataFrame.from_features(c)
gdf.crs=c.crs.get('init')
gdf.head()

Operating system

Win 11

Fiona and GDAL version and provenance

Fiona 1.8.22 with print (osgeo.gdal.version) 3.5.2
Fiona 1.8.13 with print (osgeo.gdal.version) 3.0.2

@rbuffat
Copy link
Contributor

rbuffat commented Dec 5, 2022

@UrbanGISer I can't reproduce this issue with Fiona 1.8.22 and GDAL 3.6.0. Without any error messages, it is hard to guess what could be the issue here.

@UrbanGISer
Copy link
Author

Thanks, Buffat ! I will update my GDAL and try it

@UrbanGISer
Copy link
Author

THanks, I just update my GDAL and fiona, it throw out the following error

import fiona
from osgeo import gdal
print(fiona.version)
print(gdal.version)
path="https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip"
c = fiona.open(path,layer=0)

1.8.22
3.6.0

CPLE_OpenFailedError Traceback (most recent call last)
File fiona_shim.pyx:83, in fiona._shim.gdal_open_vector()

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

CPLE_OpenFailedError: '/vsicurl/https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip' not recognized as a supported file format.

During handling of the above exception, another exception occurred:

DriverError Traceback (most recent call last)
Input In [13], in <cell line: 6>()
4 print(gdal.version)
5 path="https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip"
----> 6 c = fiona.open(path,layer=0)

File D:\ProgramData\Anaconda3\envs\my_python_env\lib\site-packages\fiona\env.py:417, in ensure_env_with_credentials..wrapper(*args, **kwargs)
415 with Env.from_defaults(session=session):
416 log.debug("Credentialized: {!r}".format(getenv()))
--> 417 return f(*args, **kwargs)

File D:\ProgramData\Anaconda3\envs\my_python_env\lib\site-packages\fiona_init_.py:264, in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, **kwargs)
261 path = parse_path(fp)
263 if mode in ('a', 'r'):
--> 264 c = Collection(path, mode, driver=driver, encoding=encoding,
265 layer=layer, enabled_drivers=enabled_drivers, **kwargs)
266 elif mode == 'w':
267 if schema:
268 # Make an ordered dict of schema properties.

File D:\ProgramData\Anaconda3\envs\my_python_env\lib\site-packages\fiona\collection.py:162, in Collection.init(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)
160 if self.mode == 'r':
161 self.session = Session()
--> 162 self.session.start(self, **kwargs)
163 elif self.mode in ('a', 'w'):
164 self.session = WritingSession()

File fiona\ogrext.pyx:540, in fiona.ogrext.Session.start()

File fiona_shim.pyx:90, in fiona._shim.gdal_open_vector()

DriverError: '/vsicurl/https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip' not recognized as a supported file format.

@sgillies
Copy link
Member

@UrbanGISer can you try path="zip+https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip" instead?

@sgillies sgillies self-assigned this Feb 10, 2023
@UrbanGISer
Copy link
Author

Thanks, but it still does not work:
import fiona
path="zip+https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip"
layerlist = fiona.listlayers(path)


CPLE_OpenFailedError Traceback (most recent call last)
File fiona_shim.pyx:83, in fiona._shim.gdal_open_vector()

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

CPLE_OpenFailedError: '/vsizip/vsicurl/https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip' does not exist in the file system, and is not recognized as a supported dataset name.

During handling of the above exception, another exception occurred:

DriverError Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 layerlist = fiona.listlayers(path)

File D:\ProgramData\Anaconda3\envs\my_python_env\lib\site-packages\fiona\env.py:417, in ensure_env_with_credentials..wrapper(*args, **kwargs)
415 with Env.from_defaults(session=session):
416 log.debug("Credentialized: {!r}".format(getenv()))
--> 417 return f(*args, **kwargs)

File D:\ProgramData\Anaconda3\envs\my_python_env\lib\site-packages\fiona_init_.py:362, in listlayers(fp, vfs)
359 else:
360 pobj = parse_path(fp)
--> 362 return _listlayers(vsi_path(pobj))

File fiona\ogrext.pyx:1659, in fiona.ogrext._listlayers()

File fiona_shim.pyx:90, in fiona._shim.gdal_open_vector()

DriverError: '/vsizip/vsicurl/https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip' does not exist in the file system, and is not recognized as a supported dataset name.

@sgillies
Copy link
Member

I can confirm that this is no longer an issue for Fiona 1.9.2, which will be released today.

Finished processing dependencies for Fiona==1.9.2.dev0
(venv) $ python
Python 3.11.0 (main, Nov  2 2022, 11:35:09) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fiona
>>> path="zip+https://raw.githubusercontent.com/UrbanGISer/Test/main/Case05new.gdb.zip"
>>> fiona.listlayers(path)
['MSA574', 'MSAPCP', 'MSA570F', 'MSAtimeF', 'MSAtime', 'MSA570', 'MSAfinal', 'MSA_Bkg_570', 'MSAPCP0509', 'MSAtime510', 'MSAfinal1', 'MSA2svca', 'MSA2svca20m', 'TwoStepVCATable2', 'TwoStepVCATable3']

@UrbanGISer
Copy link
Author

@sgillies thanks a lot !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants