TransWikia.com

How to read geometry from gpkg?

Geographic Information Systems Asked on November 1, 2021

I have a gpkg file. I trying to open it with spatial_lite gui and cast geometry to GML.

select AsGML(geom) from MyTable

but i got null. I tried another functions AsText(), AsWKT(), st_asText()... but anyway i got null. BTW function ST_GeometryType(geom) returns LINESTRING, but other functions don’t work.
My final goal is to cast geometry from gpkg to GML on c#. But it’s looks impossible because I cannot even select geometry in spatial_lite gui.
Do I use wrong queries? What can be wrong here?

One Answer

The binary format for geometry in GeoPackages is not compatible with the format used in Spatialite. That's (partly) why GDAL has separate drivers.

When I start the Spatialite GUI it helpfully displays this:

enter image description here

And that means instead of querying the table d I can query vgpkg_d and the Spatialite geometry functions will work:

enter image description here

If I query from the original table I get NULL, like you.

enter image description here

If your spatialite GUI doesn't show that message or create the virtual tables then you need to upgrade or install some other components.

Answered by Spacedman on November 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP