<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 2014-09-30 17:08, Even Rouault
wrote:<br>
</div>
<blockquote cite="mid:201409302208.26031.even.rouault@spatialys.com"
type="cite">
<pre wrap="">Le mardi 30 septembre 2014 20:20:14, Andre Vautour a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">Hi all,
I am trying to use a geometry binary predicate (ST_Intersects) in
ExecuteSQL() with the SQLite dialect and keep getting back an
"ST_Intersect function does not exist" error back from SQLite.
GDAL is built with SpatiaLite (HAVE_SPATIALITE is defined), but I
believe the problem is that SpatiaLite is built without GEOS in our
case, so those predicate functions end-up not being available in
SpatiaLite. The end result is that OGRSQLiteRegisterSQLFunctions does
not add the OGR-based predicate functions as SpatiaLite is present, but
SpatiaLite does not contain the predicate functions.
I would build SpatiaLite with GEOS support, but unfortunately its LGPL
licensing is too restrictive for our application. So, would it make
sense to change the logic in OGRSQLiteRegisterSQLFunctions to account
for the case of SpatiaLite being built without GEOS?
</pre>
</blockquote>
<pre wrap="">Andre,
That makes sense. I guess that can only be checked at runtime though, probably
by issuing a ST_Intersects() and checking the error code.
I'd note that the spatial predicates in OGR geometry are also based on GEOS.
Except OGRGeometry::Intersects() that has a simplified implementation based on
bounding box intersection when GEOS is not available.
Some time ago, I had a look at boost geometry (
<a class="moz-txt-link-freetext" href="http://www.boost.org/doc/libs/1_56_0/libs/geometry/doc/html/index.html">http://www.boost.org/doc/libs/1_56_0/libs/geometry/doc/html/index.html</a> ). That
could be used as an alternative backend to GEOS for most predicates and
functions returning geometries, and the boost licence is a modified X/MIT.
</pre>
</blockquote>
In that case, I might lean towards implementing the binary
predicates as SQLite functions at our level given that we have a
proprietary implementation of ISO 19107.<br>
<br>
In order to do so, I'd need to have a way to add functions to the
created sqlite3 object. Assuming we cache the sqlite data source
between SQL executions, one option would be to enable the loadable
extensions on the created sqlite3 object like is done in
sqlite\test_load_virtual_ogr.c using
sqlite3_enable_load_extension(). I could then call ExcuteSQL() with
"SELECT load_extension(...)". Another option would be to expose a
callback that would allow an application to add functions to an
SQLite database when it is created, that is, expose something
similar to OGR2SQLITEModule::SetHandleSQLFunctions().<br>
<br>
Yet another option would be to allow for an extension point by
introducing something like an OverlayStrategy and having the default
be the GEOSOverlayStrategy. That would allow for the boost::geometry
extension point you were talking about, and allow applications that
have their own geometry library like us to use their in house
implementation for predicates and overlays.<br>
<br>
Would you guys be willing to take one of those options?<br>
<br>
Thanks again,<br>
André<br>
<br>
<blockquote cite="mid:201409302208.26031.even.rouault@spatialys.com"
type="cite">
<pre wrap="">Even
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<div style="width:600px;"> <b>André Vautour</b>, B.Sc.<br>
Application Developer<br>
<a href="http://www.caris.com"><img
src="cid:part2.02020507.01080506@caris.com" alt="CARIS"
height="45" width="106" border="0"></a>
<!--<p style="padding-top:10px;"><strong style="color:#004680;">CARIS</strong>-->
<br>
115 Waggoners Lane<br>
Fredericton, New Brunswick<br>
Canada E3B 2L4<br>
Tel: +1.506.458.8533 Fax: +1.506.459.3849<br>
<a href="http://www.caris.com">www.caris.com</a>
<p style="margin-top:26px;"> <strong>Connect with CARIS</strong><br>
<a href="http://www.twitter.com/CARIS_GIS"><img
src="cid:part5.04060706.00010305@caris.com" alt="Twitter"
height="32" width="32" border="0"></a> <a
href="http://www.linkedin.com/groups?mostPopular=&gid=3217878"><img
src="cid:part7.03050207.06070508@caris.com" alt="LinkedIn"
height="32" width="32" border="0"></a> <a
href="http://www.facebook.com/pages/CARIS-The-Marine-GIS-Experts/123907500987669?v=app_4949752878"><img
src="cid:part9.06000502.04010303@caris.com" alt="FaceBook"
height="32" width="32" border="0"></a> <a
href="http://www.youtube.com/user/CARISGIS"><img
src="cid:part11.02000109.03030807@caris.com" alt="YouTube"
height="32" width="32" border="0"></a> </p>
<p style="margin-top:26px; line-height:1.5em;">Download your
free copy of CARIS Easy View today!<br>
<a href="http://www.caris.com/easyview">www.caris.com/easyview</a></p>
<p>_________________________________________________________________________<br>
This email and any files transmitted with it are confidential
and intended only for the addressee(s). If you are not the
intended recipient(s) please notify us by email reply. You
should not use, disclose, distribute or copy this
communication if received in error.</p>
<p> Any views or opinions expressed in this email are solely
those of the author and do not necessarily represent those of
the company. No binding contract will result from this email
until such time as a written document is signed on behalf of
the company.</p>
</div>
</div>
</body>
</html>