I've been looking into GeoPackage recently and had some questions about
its capabilities, plus its use with Spatialite. GPKG seems to have
broader library/language support--I can access them via JavaScript for
instance--but I'm very confused about their capabilities.
* Can they be fully queried in Spatialite? It looks like there is
support, but I'm wondering if I can run all supported spatial functions
or just a subset?
* Does the Spatialite support modify the database, replacing or
inserting Spatialite-compatible geometries for the GPKG ones? Or are
they translated in place?
* Do I need to create my GPKG in a certain way? Seems GDAL supports
vector and raster GPKG formats, but I don't know what the difference is,
or if one works for spatial queries while the other doesn't.
* Is it possible to perform spatial queries on GPKG files without
Spatialite?
I don't have a strong aversion to Spatialite, but I remember
3-4 years ago that the Android version corrupted files larger than 2 GB
and there wasn't a whole lot of certainty about how to fix it.
I'd also
like to experiment with geospatial data in React Native, so if I can use
GPKG's native JS library then that lowers the barrier some. Still
though, if I can use all my tools on the same dataset then that's a win.
Thanks.
I don't have a strong aversion to Spatialite, but I remember
3-4 years ago that the Android version corrupted files larger than 2 GBThis is true for all files stored on Android- they use a 'signed integer' instead of an 'unsigned integer'-- thus adding something (such has a tile) will fail, but not corrupt, if the final result is > 2 GB
Hmm, so it sounds like this issue may have been fixed then? I don't recall on which version I last encountered it but I know it was still true with the Android geopaparazzi Spatialite as of early 2014. I don't know if this ships/shipped its own SQLite library at that time or if it relied on Android's.
Also, to be clear about my use case, it wasn't with the sqlite
binary. I was opening the database read-only in my app's code, and
the md5sum of the database file would change before and after it
was accessed. Nothing in my app wrote to the database, and the
same code worked fine on my laptop.
If this still sounds like the same bug that was fixed, then great! At the time I remember there being confusion, and I'm not smart enough to fix it myself. Would love to transition this project back to Spatialite rather than trying to figure out gpkg.
--
You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spatialite-use...@googlegroups.com.
To post to this group, send email to spatiali...@googlegroups.com.
Visit this group at https://groups.google.com/group/spatialite-users.
For more options, visit https://groups.google.com/d/optout.
Hmm, so it sounds like this issue may have been fixed then? I don't recall on which version I last encountered it but I know it was still true with the Android geopaparazzi Spatialite as of early 2014. I don't know if this ships/shipped its own SQLite library at that time or if it relied on Android's.
Also, to be clear about my use case, it wasn't with the sqlite binary. I was opening the database read-only in my app's code, and the md5sum of the database file would change before and after it was accessed. Nothing in my app wrote to the database, and the same code worked fine on my laptop.
If this still sounds like the same bug that was fixed, then great! At the time I remember there being confusion, and I'm not smart enough to fix it myself. Would love to transition this project back to Spatialite rather than trying to figure out gpkg.
When thinking about GeoPackage support in SpatiaLite, consider that the geometry in the database is not the same as the geometry in memory.
There is "native" spatialite format (which changed in 2.4), FDO, geopackage, and potentially other formats that are basically simple features.
There can also be other data structures, like topology or routing networks.
The functions that operate on simple features don't work on the serialised (in database / blob) formats directly, but rather the in-memory datastructures (e.g. gaiaPoint, gaiaLinestring).
So any of those simple features functions should work for GeoPackage.
You should not expect routing functions or topology functions to work because there is no matching capability in GeoPackage.
ATTACH Database 'somefile.gpkg' AS db_gpkg;
SELECT GeomFromGPB(gpkg_geometry) AS spatialite_geometry FROM db_gpkg.gpkg_table WHERE ...
-- Save a spatialite Geometry to a ATTACHed GeoPackage-Database
-- UPDATE db_gpkg.gpkg_table SET gpkg_geometry= (SELECT AsGPB(spatialite_geometry) FROM spatialite_table WHERE ...);
Brad