Discussion:
[Jts-topo-suite-user] question on isValidOp()
John Cartwright - NOAA Federal
2016-01-15 00:00:35 UTC
Permalink
Hello All,

I'm confused about the isValidOp.setSelfTouchingRingFormingHoleValid(true)
method. Given a bow-tie polygon like the one below, I would have expected
setting the above option to cause the polygon to report as valid but it
doesn't.
​

Can someone please clarify for me?

Thanks!

--john

​//​
​//JTS version 1.14.0 with Groovy 2.4.5.​
//
wkt = '''POLYGON((1 1, 2 1, 1 2, 2 2, 1 1))'''
def geom = wktReader.read(wkt)

def validOp = new IsValidOp(geom)
validOp.setSelfTouchingRingFormingHoleValid(true)

//fails
assert geom.valid
Martin Davis
2016-01-15 00:16:18 UTC
Permalink
That polygon contains two edges that cross, which is invalid under any
setting.

The setSelfTouchingRingFormingHoleValid parameter only allows situations
where a ring self *touches*, not crosses, AND only for the situation where
the self-touch forms a hole - NOT where it splits the polygon into two
separate areas.

So these are valid with the setSelfTouchingRingFormingHoleValid flag set:

Shell self-touches and isolates a hole:

POLYGON ((100 400, 300 400, 300 300, 150 350, 150 250, 300 300, 300 200,
100 200, 100 400))

Hole self touches to form two separate hole areas:

POLYGON ((100 400, 300 400, 300 200, 100 200, 100 400), (150 350, 250 350,
200 300, 250 250, 150 250, 200 300, 150 350))

and this is not:

Bow-tie - shell split into two areas by a self-touch

POLYGON ((100 400, 300 400, 200 300, 300 200, 100 200, 200 300, 100 400))


On Thu, Jan 14, 2016 at 4:00 PM, John Cartwright - NOAA Federal <
Post by John Cartwright - NOAA Federal
Hello All,
I'm confused about the isValidOp.setSelfTouchingRingFormingHoleValid(true)
method. Given a bow-tie polygon like the one below, I would have expected
setting the above option to cause the polygon to report as valid but it
doesn't.
​
Can someone please clarify for me?
Thanks!
--john
​//​
​//JTS version 1.14.0 with Groovy 2.4.5.​
//
wkt = '''POLYGON((1 1, 2 1, 1 2, 2 2, 1 1))'''
def geom = wktReader.read(wkt)
def validOp = new IsValidOp(geom)
validOp.setSelfTouchingRingFormingHoleValid(true)
//fails
assert geom.valid
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Jts-topo-suite-user mailing list
https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user
Loading...