[geos-devel] Geometry/Rectangle Intersection, line merging ?

Mika Heiskanen mika.heiskanen at fmi.fi
Tue Sep 9 07:07:40 PDT 2014


On 09/09/2014 04:55 PM, Sandro Santilli wrote:
> On Tue, Sep 09, 2014 at 04:45:11PM +0300, Mika Heiskanen wrote:
>> On 09/09/2014 04:06 PM, Sandro Santilli wrote:
>
>>> One failing test (when using ST_Intersection) is this one
>>> (number 87 in the unit test):
>>>
>>>      // triangle corner at left edge
>>>      Input:   LINESTRING (3 3,0 6,3 9)
>>>      Desired: LINESTRING (3 3,0 6,3 9)
>>>
>>> ST_Intersection outputs this instead:
>>>
>>>      Output:  MULTILINESTRING ((0 6, 3 9), (0 6, 3 3))
>>
>> I do not see why the output should be split unless it has been
>> agreed in some (de facto?) standard. Has it?
>
> Not really. It just happen to be the case due to the algorithm used
> for the overlay based intersection. When the topology is built the
> edge do not get sewed unless needed (ie: for polygons).
>
> I think avoiding the re-join is just done to do less work, as if needed
> it can be obtained by a subsequent step.

But in the case of the current algorithm, there is no need for re-join
as the edge point is included automatically. The algorithm will skip
edges which travel along the edges of the rectangle, not single vertices
that just visit an edge. No amount of work is really saved by skipping
the edge point. In fact, one might argue it would be slower to skip
it since then there would be two memory allocations for the separate
linestrings instead of just one for one linestring.

Regards,

Mika Heiskanen / FMI



More information about the geos-devel mailing list