<div dir="ltr"><div><span style="color:rgb(0,0,0);font-family:"trebuchet ms",sans-serif;font-size:medium">Ok.. From the Spatialite 4.2.0 wiki:</span></div><div> <br></div><div><ul style="padding:0px 0px 0px 30px;margin:0px;color:rgb(0,0,0);font-family:sans-serif;font-size:medium"><li><b><i>CastAutomagic()</i></b>: will indifferently accept both GPKG and SpatiaLite BLOB Geometries, then returning anyway a SpatiaLite's own BLOB Geometry.</li></ul><div><font color="#000000" face="sans-serif" size="3"><br></font></div></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif">I can confirm, that using the "CastAutomagic(geom)" function instead of the simple field "geom"  will get the st_area and other ogc functions in the QGIS Databasemanager Dataprovider for GeoPackage to work. </font></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif"><br></font></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif">That means that the geopackage binary format for geometry is incompatible with the underlying spatialite spatial system and functions. </font></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif"><br></font></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif">This is <b style="">not</b> the most helpful and thoughtful user oriented solution I've encountered ... Or should I have RTFM somewhere in the QGIS.org site ? </font></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif"><br></font></div><div><font color="#000000" size="3" face="trebuchet ms, sans-serif">However it does work. Thanks for the tip </font></div><div><font color="#000000" face="sans-serif" size="3"><br></font></div><div><font color="#000000" face="sans-serif" size="3"><br></font></div><div><font color="#000000" face="sans-serif" size="3"><br></font></div></div><br><div class="gmail_quote"><div dir="ltr">Den tor. 13. sep. 2018 kl. 13.20 skrev Jean-Baptiste Desbas <<a href="mailto:jb.desbas@gmail.com">jb.desbas@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi,</div><div><br></div><div>I have to use <b>st_area(CastAutomagic(geom)) </b>instead of 
<b>st_area(geom)</b>, otherwise null column is retourned.

</div></div></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 13 sept. 2018 à 11:45, Bo Victor Thomsen <<a href="mailto:bo.victor.thomsen@gmail.com" target="_blank">bo.victor.thomsen@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Lene -<div><br></div><div>I've made a few observations regarding the use of GeoPackage in DBManager...</div><div><br></div><div>I have a <i>GeoPackage</i> based table called "renhold" containing polygons. Primary key column is an integer called "fid" and the geometry column is called "geom" - It's pretty close to your setup</div><div><br></div><div>If I use the <i>DBManager</i> with the <i>GeoPackage </i>dataprovider and execute the following statement: <b>select fid, st_area (geom) from renhold , </b>it returns a table with 2 columns as expected. However , column nr. 2 contains only nulls. However, the statement does not result in an error. The function "st_area" simply doesn't return a value besides null.</div><div><br></div><div>An now the mystery!! :</div><div><br></div><div>If I use the <i>DBManager</i> with the <i>Virtual Layers -> Project layers </i>dataprovider and execute the following statement: <b>select fid, st_area (geometry) from renhold , </b>it returns a table with 2 columns as expected. And column nr. 2 do contain the expected area values. Go figure...<br></div><div><br></div><div>NB! The "renhold" layer is visible in the map and named "renhold" </div><div>NBB! In the <i>Virtual Layers</i> dataprovider you have to use the standard name "geometry" to represent the geometry column - not the real column name ("geom" in this case)</div><div><br></div><div>Actually I have a reasonable explanation: The 2 different dataproviders uses different internal functions to calculate the area. However the function used by the GeoPackage Dataprovider doesn't work !</div><div><br></div><div><br></div><div>Regards </div><div>Bo Victor Thomsen</div><div>LIFA Denamrk</div><br><div class="gmail_quote"><div dir="ltr">Den tor. 13. sep. 2018 kl. 09.27 skrev Alexandre Neto <<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Lee, <div><br></div><div>Can you try removing the quotation marks around geom? </div><div><br></div><div>Best wishes, </div><div><br></div><div>Alex Neto<br><br><div class="gmail_quote"><div dir="ltr">A qui, 13/09/2018, 02:04, Lene Fischer <<a href="mailto:lfi@ign.ku.dk" target="_blank">lfi@ign.ku.dk</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div bgcolor="#FFFFFF">
<div style="direction:ltr;font-family:Arial;color:rgb(0,0,0);font-size:10pt">
<div>Hi,</div>
<div>Trying out a geopackage layer in DBManager asking a simple SQL statement st_area</div>
<div>But when I try to write a statement like this<br>
</div>
<div><br>
</div>
<div>SELECT "vandopland".* , st_area("vandopland"."geom") as areal_m2<br>
FROM "vandopland"</div>
<div><br>
</div>
<div> "geom" is not found. Suggestions as geomfromexifgpsblob or geomfromfgf or geomfromwkb . Then I get "an error occured"</div>
<div><br>
</div>
<div>Any suggestions what I might have done wrong.</div>
<div><br>
</div>
<div>Regards from a newbee Geopagkace/DBmanager</div>
<div><br>
</div>
<div>Lene Fischer<br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>

_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div></div>-- <br><div dir="ltr" class="m_5382124497717547315m_-8051348308166003743gmail-m_-1459157742685822879gmail_signature"><div dir="ltr"><div>Alexandre Neto</div><div>---------------------</div><div>@AlexNetoGeo</div><div><a href="http://sigsemgrilhetas.wordpress.com" target="_blank">http://sigsemgrilhetas.wordpress.com</a></div><a href="http://gisunchained.wordpress.com" target="_blank">http://gisunchained.wordpress.com</a><br></div></div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_5382124497717547315m_-8051348308166003743gmail_signature">Med venlig hilsen<div><br></div><div>Bo Victor Thomsen</div><div><br></div></div></div></div>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Med venlig hilsen<div><br></div><div>Bo Victor Thomsen</div><div><br></div></div>