Writing GPKG file failing on Windows
See original GitHub issueFrom https://github.com/geopandas/geopandas/pull/870#issuecomment-484003547
Currently, the tests for GPKG writing on Appveyor + Python 2.7 are skipped. The error we see is (https://ci.appveyor.com/project/jorisvandenbossche/geopandas-us6w0/builds/23408016/job/v7g468n7dml8t43v):
____ TestGeoDataFrameToFile.test_geodataframe_to_file[geodataframe0-GPKG] _____
self = <geopandas.tests.test_geodataframe_to_file.TestGeoDataFrameToFile instance at 0x000000000E29C288>
geodataframe = a geometry
0 1 POINT (-73.55378500000001 45.508722)
1 2 POINT (-73.554138 45.50908)
ogr_driver = 'GPKG'
def test_geodataframe_to_file(self, geodataframe, ogr_driver):
expected_error = _expected_error_on(geodataframe, ogr_driver, _FIONA18)
if expected_error:
with pytest.raises(expected_error.type, match=expected_error.match):
geodataframe.to_file(self.output_file, driver=ogr_driver)
else:
> self._assert_to_file_succeeds(geodataframe, ogr_driver)
geopandas\tests\test_geodataframe_to_file.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
geopandas\tests\test_geodataframe_to_file.py:330: in _assert_to_file_succeeds
gdf.to_file(self.output_file, driver=ogr_driver)
geopandas\geodataframe.py:429: in to_file
to_file(self, filename, driver, schema, **kwargs)
geopandas\io\file.py:123: in to_file
colxn.writerecords(df.iterfeatures())
C:\Miniconda-x64\envs\test-environment\lib\site-packages\fiona\collection.py:421: in __exit__
self.close()
C:\Miniconda-x64\envs\test-environment\lib\site-packages\fiona\collection.py:403: in close
self.flush()
C:\Miniconda-x64\envs\test-environment\lib\site-packages\fiona\collection.py:393: in flush
self.session.sync(self)
fiona/ogrext.pyx:1085: in fiona.ogrext.WritingSession.sync
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E CPLE_AppDefinedError: sqlite3_exec(CREATE VIRTUAL TABLE "rtree_output_file_geom" USING rtree(id, minx, maxx, miny, maxy)) failed: no such module: rtree
fiona/_err.pyx:185: CPLE_AppDefinedError
------------------------------ Captured log call ------------------------------
collection.py 156 WARNING CPLE_AppDefined in The '' extension is not allowed by the GPKG specification, which may cause compatibility problems
collection.py 156 WARNING CPLE_NotSupported in dataset c:\users\appveyor\appdata\local\temp\1\tmpxzg1ww\output_file does not support layer creation option ENCODING
collection.py 393 ERROR CPLE_AppDefined in sqlite3_exec(CREATE VIRTUAL TABLE "rtree_output_file_geom" USING rtree(id, minx, maxx, miny, maxy)) failed: no such module: rtree
So it gives an error indicating that sqlite was not properly build with rtree enabled. However, this should be the case since https://github.com/conda-forge/sqlite-feedstock/pull/20
@ljwolf noted here https://github.com/geopandas/geopandas/pull/870#issuecomment-484003547 that there might be a mistake in the bld script.
@ocefpaf @snorfalorpagus should maybe also open an issue on the sqlite feedstock?
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (7 by maintainers)
Top Results From Across the Web
Unable to open database file (gpkg) when creating layers in ...
I have some PyQGIS code to create multiple layers in a QGIS project using a for loop. This code previously worked for me...
Read more >Writing Geometries with GeoPackage Writer is not possible.
I'm trying to write a GeoPackage-Layer from a Shape file with linear Features. It' s not possible for me to define the Geometry...
Read more >GPKG - Manifold.net
GPKG is the OGC GeoPackage format for storing vector and raster spatial data within an SQLite database container within a single .gpkg file....
Read more >GPKG – GeoPackage raster — GDAL documentation
This driver reads and writes SQLite files from the file system, so it must be run by a user with read/write access to...
Read more >OGC GeoPackage
Official GeoPackage web site of the Open Geospatial Consortium. ... the security issues of the device cause a lot of problems for cross-app...
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 Free
Top 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

For me (still on windows), I can write a gpkg but I still get an error that the rtree module is not available in sqlite. The gpkg created indeed does not have a spatial index, but when needed I add it in QGis.
I finally gave it up on windows. Im using it via Virtual Box in Linux. Not solving the problem tho, but now I don’t get an error, but my python console crashes everytime I try to write a GPKG.