[Qgis-user] geopackage spatial query

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Mon Oct 29 12:47:57 PDT 2018


Hi Klaus -

Even though the GeoPackage format is using a spatialite database as the 
foundation, the internal format of the geopackage geometry type differs 
from the spatialite type. So yon can't directly use spatialite geometry 
based function with geopackage geometries.

However you can "wrap" every use of GeoPackage geometries in a converter 
function: *CastAutomagic(geom)*, which converts a GeoPackage geometry to 
a Spatialite geometry.

So a call to: /st_area (geom)/ becomes /st_area(*CastAutomagic(*geom*)*)/

(No, It's not nice and it certainly not effective use of computer 
resources, however it works.)

There is a thread about the why's and why-not's for this subject in the 
QGIS-user list around september 13 , 2018

Regards

Bo Victor Thomsen
LIFA Landinspektører A/S,
Denmark




Den 29/10/2018 kl. 14.35 skrev Mithoefer:
> Dear List,
>
> I have a geopackage database and tried to use a spatial sql function 
> (st_area) using the db manager in qgis 3.4  --> select st_area(geom) 
> from polygon_filename. The function is available, but the result is 
> Null. What is the problem?
>
> Thanks a lot
>
> Kind regards
>
> Klaus
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20181029/12ec2685/attachment.html>


More information about the Qgis-user mailing list