ST_OffsetCurve - number of parameters changed from 3 t

85 views
Skip to first unread message

Martin Gray

unread,
Sep 24, 2015, 6:43:00 PM9/24/15
to SpatiaLite Users
I run QGIS 2.8.1 (Spatialite 4.1.1) and Spatialite GUI 2.0 which tells me it is using v4.3

The issue I have is that the ST_OffsetCurve function has changed between V4.2 (maybe earlier) and V4.3  in that for 4.3 the command is

ST_OffsetCurve( geom Curve , radius Double precision ) 

While in V4.2 the command is

ST_OffsetCurve( geom Curve , radius Double precision , left_or_right Integer

This makes it difficult to develop scripts in QGIS as I need to reformat them from tests carried out in Spatialite.  And yes I know that there will always be issues with different version but my question is:

Which is the correct number of parameters and going forward what will be used in Spatialite?


Oh and for whoever does the documentation there is a spelling mistake in the on-line documentation which always catches me out - the documentation incorrectly spells ST_ClosestPoint as ST_ClosesetPoint ie an extra e between the second s and the t.


Cheers


Martin





a.fu...@lqt.it

unread,
Sep 25, 2015, 11:21:56 AM9/25/15
to spatiali...@googlegroups.com
On Thu, 24 Sep 2015 15:42:59 -0700 (PDT), Martin Gray wrote:
> I run QGIS 2.8.1 (Spatialite 4.1.1) and Spatialite GUI 2.0 which
> tells
> me it is using v4.3
>
> The issue I have is that the ST_OffsetCurve function has changed
> between V4.2 (maybe earlier) and V4.3  in that for 4.3 the command is
>
>> ST_OffsetCurve( geom Curve , radius Double precision ) 
>
> While in V4.2 the command is
>
>> ST_OffsetCurve( geom Curve , radius Double precision , LEFT_OR_RIGHT
>> INTEGER ) 
>

Hi Martin,

the ST_OffsetCurve() SQL function is fully based on GEOS support,
and when it was initially implemented GEOS offered an API named
GEOSSingleSidedBuffer_r() requiring both a "width" argument
(offset distance) and a "leftSide" argument intended to specify
if the offset was to be applied on the left or on the right side.

in a second time GEOS has formally deprecated the initial
GEOSSingleSidedBuffer_r() API and a brand new GEOSOffsetCurve_r()
has been introduced.
the most recent API is intended as a full replacement, and just
requires the "width" argument:
- if the "width" value is negative the left side is assumed.
- if the "width" value is positive the right side is assumed.

unhappily this very relevant change on the GEOS side passed
completely unnoticed and wasn't incorporated in spatialite
as quickly as it ought be.
during the development cycle of spatialite 4.3.0 some user
privately reported that calling ST_OffsetCurve() frequently
returned "crazy" results, and sometimes caused some unexpected
crash.
at this point I started a thorough review of the code implementing
ST_OffsetCurve(), and I finally realized that we were inadvertently
still using the bad, dangerous and officially deprecated
GEOSSingleSidedBuffer_r() API.
switching to the most recent GEOSOffsetCurve_r() caused as a
side effect the suppression of the latest argument simply because
it's now become completely useless and meaningless.

... and that's the full history about ST_OffsetCurve()

bye Sandro
Reply all
Reply to author
Forward
0 new messages