Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] Remove line from within another line

More thoughts on implementation...  your idea about converting to a MultiPoint and differencing that might be a direction worth exploring.  (Note that only the longer line needs to be a MultiPoint I think).  The only concern is ensuring that the remaining points have their order preserved so that you can recover the linestring correctly.  I think JTS does this now.

On Wed, Oct 10, 2018 at 3:23 PM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Makes sense...   I agree with you about the limits of the OGC theoretical model.  It's a very good starting point for a spatial API, but there's no need to be limited by it for real world problems.  (Mind you, as I'm sure you will agree the world of spatial processing is extremely wide... so there has to be some prioritization for the sake of budget and user comprehension).

Given the use case, I'd suggest that using difference is perhaps overkill, and a more low-level approach would be preferable.  That is to scan the longer line (LHS) and discard every vertex which appears in the shorter line (RHS).  As the scan is done add the preserved points to a new line(s).  There's a bit of fiddly bookkeeping involved, but it's conceptually simple.  The snapping can even be incorporated in this algorithm directly, by using a distance tolerance.  If the lines are very long a spatial index can be used to make this performant.

Maybe this could be called LineStringUtil.remove( LineString )...   Or there might be a nice fit for this in the LinearReferencing package.

On Wed, Oct 10, 2018 at 3:09 PM Simon (SPDBA) Greener <simon@xxxxxxxxxxxx> wrote:
Can one convert both linestrings to multipoints, do the difference and then convert the result back to a linestring?

Real world use case? One line is a survey traverse with observations at the ends of another linear object.
The survey traverse + observerd linear object is treated as a single linearring for the purpose of adjustment (cf Bowditch).
Then the linear object is extracted by removal of the traverse and the end "tie lines".

I tend to see OGC etc standards are being the products of theoretical minds, while the necessary base for geoprocessing, one could say that their perspective is only one part of the reality. Then you have the situation where they do things that are highly reactionary, following rather than leading.



Back to the top