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?

  • 1
    are there any rows in your table?
    – Ian Turton
    Commented Jul 20, 2020 at 13:27

1 Answer 1


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.

  • Is it warped tables created by spatialite_gui right? So they not conteins in original gpkg file? Is it means that i can not to call them from c# using just a sqlite provider?
    – Kliver Max
    Commented Jul 23, 2020 at 13:19
  • In the end i just added GDAL to project.
    – Kliver Max
    Commented Jul 24, 2020 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.