"sqlite3_open" error whith geopackage
See original GitHub issueThe error occur in images_to_samples.py, when we have more than 1000 images to prepare.
...
Images/mtq_f09_257000_5077000_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12404}
Images/15_2525134f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12501}ERROR 4: sqlite3_open(chapeau_mtm09_lac_riv_build.gpkg) failed: unable to open database file
Images/mtq_f09_260000_5081000_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12516}
Images/15_2495160f09_dc_45_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12714}
Images/15_2575131f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12714}
Images/15_2605131f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12756}
Images/15_2455150f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12793}
Images/mtq_f09_262000_5093000_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12799}
Images/15_2715113f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12854}
Images/15_2505138f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12858}
Images/15_2595126f09_dc_50_int_rou_asp_slo.tif
{'trn': 42601, 'val': 12888}
Traceback (most recent call last):
File "images_to_samples.py", line 258, in <module>
params['sample']['mask_reference'])
File "images_to_samples.py", line 209, in main
vector_to_raster(info['gpkg'], info['attribute_name'], label_raster)
File "images_to_samples.py", line 133, in vector_to_raster
source_layer = source_ds.GetLayer()
AttributeError: 'NoneType' object has no attribute 'GetLayer'
One of the possible solutions might include:
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
QGIS 2.14.9 refuses to open GeoPackage file
I tried to open in QGIS 2.14.9 a .gpkg file but this action resulted in an error message stating that the file is...
Read more >Unable to view SQLite Databases or GeoPackage file...
I cannot see .sqlite or .gpkg in the catalog window of ArcMap or ArcGIS Pro. I have visited the documentation pages for ArcMap...
Read more >Error reading geopackage - FME Community - Safe Software
It opens nicely in QGIS (where it displays the rasters) and with a SQLite client I'm able to access the tables. The error...
Read more >Make it possible to 'just open' a gpkg [sqlite] #1324 - GitHub
In the 'geo'-world we try to push 'GeoPackages' as an open alternative for the ancient shapefiles (.shp + sidecars). The geopackage standard is ......
Read more >Sqlite3, OperationalError: unable to open database file
Primary diagnosis: SQLite is unable to open that file for some reason. Checking the obvious reasons why, and in approximate order that I ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The following was tested on Windows 10 using Anaconda.
In conda 4.5.12 python 3.7.2 and activating Fiona 1.8.4 and Rasterio 1.0.13 are good alternative to direct use of OGR and GDAL as described in image_to_samples.py in the preceding comment.
I tested a prototype using Fiona and Rasterio to read a GeoPackage file containing 500 000 vector features and for each feature reading a portion of a GeoTIFF file using Rasterio and it works well.
I found one problem when creating the GPKG file with Fiona it exits with the following message
It’s not an error as the Process exit with code 0 and it said in the message Exception ignored. The GPKG file seems to be created correctly.
As reported here by @sgillies “This has nothing to do with fiona or the rtree python package. See section 2 of https://www.sqlite.org/rtree.html.”
I was able to run this python program without the previous error in conda 4.5.12 in python 3.7.2 by importing manually the Fiona wheel Fiona‑1.8.4‑cp37‑cp37m‑win_amd64.whl and the GDAL wheel GDAL‑2.3.3‑cp37‑cp37m‑win_amd64.whl and addiing the path to the GDAL DLL
Finally, I noticed at least one difference in the .gpkh file produced. In the environement wich produced the error, the spatial index of the layers are not created whereas they are created in the environment from the wheel distribution.
So two options are possible for solving this issue:
The second avenue (request to Anaconda) should be the prefered choice.
DanEli bypassed the conda packaging problem by doing what he describes above : create a “vanilla” conda environment with Python 3.7 and manually install the wheel files and make sure they’re on the path.
We have not tested with more recent versions of conda and/or Fiona so maybe the issue is fixed now but if it’s not you’ll have to manually install stuff. Sorry we can’t be more helpful. If you do find how to set this up nice and clean, please let us know.
Good luck