Hello. Thank you guys for good advice. So far, I have a workaround to filter out false crossings by creating a single sided buffer on each side of one LineString, then shrink it. If both of those shrinked single-sided buffers intersect the other LineString, then it is a strict crossing.
I will look into Noder and such. - Tore. On 21 Oct 2014, at 00:17, Martin Davis <[email protected]> wrote: > Good point, Michael. That would be an elegant and efficient way to implement > the "strict crosses" predicate. > > And there's a fair bit of existing SegmentIntersector code which does > "almost" the needed thing. See for instance SegmentIntersectionDetector. > The net new code needed is the code to build the local topology at each > intersection to test for strict crossing. > > On Mon, Oct 20, 2014 at 2:48 PM, Michael Michaud > <[email protected]> wrote: > Hi, > > It has been a long time I've not played with noding package, but would a > Noder (ex. MCIndexNoder) with an appropriate SegmentIntersector be a solution > ? > > Michaƫl >> Unfortunately the DE-9IM model (which is used to define the OGC SFS spatial >> predicates which JTS implements) doesn't allow specifying true line crossing >> (as far as I can tell). So there's no direct way to compute this using >> existing JTS predicates. >> >> Determining this condition would require building a simple topological >> structure for each LineString (essentially a chain of segments). Then each >> segment can be checked against all others to determine if a true crossing >> exists. There are three situations which need to be checked: a) crossing at >> interior point of 2 segments, (b) crossing at a vertex on one segment, and >> (c) crossing at vertices on both segments. (This is why the full topology >> is required, rather than just checking segments individually). To make this >> performant, the segments would need to be indexed in some way (for instance, >> using the JTS STRtree >> >> This seems like a useful predicate to have for JTS. Feel free to post the >> code if you implement it. >> >> >> On Mon, Oct 20, 2014 at 6:28 AM, Tore Halset <[email protected]> wrote: >> Hello. >> >> I have two LineString depth contours that I want to check for crossing. For >> this domain, overlap/touch is fine, but not crossing. >> >> The following junit-formatted example show two LineStrings that touch each >> other in (2 2). This is reported as a crossing by >> LineString#crosses(LineString), but for my domain this is not a cross. >> >> public void testCrosses() throws ParseException { >> WKTReader r = new WKTReader(); >> LineString ls1 = (LineString) r.read("LINESTRING (1 2, 3 2)"); >> LineString ls2 = (LineString) r.read("LINESTRING (1 1, 2 2, 3 1)"); >> assertFalse(ls1.crosses(ls2)); >> } >> >> Any tips to how I can check for crossing, but not touches like this? >> >> Regards, >> Tore Halset. >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://p.sf.net/sfu/Zoho >> _______________________________________________ >> Jts-topo-suite-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user >> >> >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> >> http://p.sf.net/sfu/Zoho >> >> >> _______________________________________________ >> Jts-topo-suite-user mailing list >> >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho > _______________________________________________ > Jts-topo-suite-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho_______________________________________________ > Jts-topo-suite-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Jts-topo-suite-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
