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

Martin,

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).

Agreed. Spatial is now more widely used than ever it was, but we domain experts still live in the small world of professional geomatics. I try to implement spatial with existing IT frameworks without having to purchase product from GIS vendors who then want everything bent their way. So they automatically make it hard to extend their reach out of their own echo chamber.

How many years did it take to create selection and highlight when all that was offered was a theoretical WMS which end users thought would do what the vendors' did (click, select,  highlight in yellow)! All that was offered years later was a theoretical mix of two standards WMS/WFS with no product/open source project offering and encapsulated selection and highlight that would hide implementation details. Yes, we got there but.....

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.

What I did was create a tolerance based buffer around the line to be removed then applied a within filter to remove points in main line.
I'm sure that I will find situations where this won't work. 

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

With a parameter "remove boundary points".

On a related topic, how does one execute a simple parallel offset linestring in JTS?

What LinearReferncing package?

Regards
Simon
--------------------------------------------------------------------------------------------------------
Spatial Advice & Solutions Architecture
Database Spatial Stored Procedure Designer

Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE FME
Awarded "2011 Oracle Spatial Excellence Award for Education and Research"
A: 39 Cliff View Drive, Allens Rivulet, 7150, Tas, Aust
W: www.spdba.com.au
E: simon@xxxxxxxxxxxx
V: +61 362 396 397
M: +61 418 396 391
GITC Supplier: T1005
Skype: sggreener
Long: 147.20515 (147° 12' 18" E)
Lat: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg
NAC:W80CK 7SWP3

Back to the top