[geos-devel] strange behavior with offsetCurve, resulting points get resorted

Swen Zanon swen.zanon at geoglis.de
Tue Oct 15 00:49:08 PDT 2013


unhappily not always. If you take a look at this geometry (practically a 
circle), you can see, that after processing with negative offset the first 
point gets into the middle of the resulting geometry, so reversing wont be 
helpful.

LINESTRING (356.14294691052 102.66308238186, 327.70006647611 105.1515119779, 
300.1214085709 112.54119109193, 274.24493675988 124.60758806344, 
250.85689454489 140.98407152635, 230.66791575372 161.17305031752, 
214.29143229082 184.56109253251, 202.2250353193 210.43756434353, 
194.83535620527 238.01622224874, 192.34692660923 266.45910268315, 
194.83535620527 294.90198311757, 202.2250353193 322.48064102277, 
214.29143229082 348.3571128338, 230.66791575372 371.74515504879, 
250.85689454489 391.93413383996, 274.24493675988 408.31061730286, 
300.1214085709 420.37701427437, 327.70006647611 427.76669338841, 
356.14294691052 430.25512298444, 384.58582734494 427.76669338841, 
412.16448525015 420.37701427437, 438.04095706117 408.31061730286, 
461.42899927616 391.93413383996, 481.61797806733 371.74515504879, 
497.99446153023 348.3571128338, 510.06085850175 322.48064102277, 
517.45053761578 294.90198311757, 519.93896721182 266.45910268315, 
517.45053761578 238.01622224874, 510.06085850175 210.43756434353, 
497.99446153023 184.56109253251, 481.61797806733 161.17305031752, 
461.42899927616 140.98407152635, 438.04095706117 124.60758806344, 
412.16448525015 112.54119109193, 384.58582734494 105.1515119779, 
356.14294691052 102.66308238186)

offset: -7.5

LINESTRING (199.8755753908052 266.4591026831502, 202.2496278950709 
239.3235583899549, 209.2996510238349 213.0125138788534, 220.8114333918343 
188.3254169232982, 236.4351953170404 166.0123724719978, 255.6962166993686 
146.7513510896696, 278.0092611506681 131.1275891644545, 302.6963581062222 
119.6158067964653, 329.0074026173249 112.5657836677009, 356.142946910525 
110.1917311634348, 383.2784912037251 112.5657836677009, 409.5895357148278 
119.6158067964653, 434.2766326703818 131.1275891644545, 456.5896771216814 
146.7513510896696, 475.8506985040096 166.0123724719977, 491.4744604292158 
188.3254169232983, 502.986242797215 213.0125138788533, 510.0362659259791 
239.3235583899551, 512.4103184302447 266.4591026831496, 510.0362659259791 
293.5946469763549, 502.9862427972151 319.9056914874467, 491.4744604292154 
344.5927884430122, 475.8506985040096 366.9058328943122, 456.5896771216822 
386.1668542766396, 434.2766326703829 401.790616201845, 409.5895357148264 
413.3023985698354, 383.2784912037251 420.3524216986088, 356.1429469105202 
422.726474202865, 329.0074026173249 420.3524216986088, 302.6963581062236 
413.3023985698354, 278.0092611506673 401.790616201845, 255.6962166993677 
386.1668542766396, 236.4351953170403 366.9058328943121, 220.8114333918347 
344.5927884430125, 209.2996510238349 319.9056914874467, 202.2496278950709 
293.5946469763548, 199.8755753908052 266.4591026831502)

Swen

-----Ursprüngliche Nachricht----- 
From: Sandro Santilli
Sent: Monday, October 14, 2013 9:16 AM
To: GEOS Development List
Subject: Re: [geos-devel] strange behavior with offsetCurve, resulting 
points get resorted

Left offsets retain order, while right offsets reverse it.
This is predictable, so you can reverse after a right-offset.

Unfortunately there's no Reverse function exposed in the C-API :(
if you want to provide one it'll be welcome.

--strk;

On Mon, Oct 14, 2013 at 08:51:05AM +0200, Swen Zanon wrote:
> Hi,
> i am using GEOS (3.4.x) with PHP.
> Sometimes i get a strange resorting of the points in a linestring
> after using the offsetCurve-function.
> Here is an example:
> $geosWKTReader = new GEOSWKTReader;
> $geom = $geosWKTReader->read( "LINESTRING(350 100,250 200,400
> 200,350 100)");
> $newGeom = $geom->offsetCurve(-7.5);
> die( $newGeom->__toString() );
> the result is:
> LINESTRING (268.1066017177982 192.5, 347.9453639621833
> 112.6612377556149, 387.8647450843758 192.5, 268.1066017177982 192.5)
> i would expect something like this:
> LINESTRING (347.9453639621833 112.6612377556149,...)
> Can somebody tell me, why is it so? Or is it a bug?
> The sequence of the points is very important for me, so is there a
> possibility to  prevent this behavior? Maybe by setting a parameter?
> Greets,
> Swen
_______________________________________________
geos-devel mailing list
geos-devel at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geos-devel 



More information about the geos-devel mailing list