AnsweredAssumed Answered

Geometry touches method isn't working?

Question asked by paul.haakma on Aug 26, 2016
Latest reply on Sep 1, 2016 by paul.haakma



A Geometry object has a 'touches' method, but it doesn't appear to work.


I have a given polygon, and have tested with polylines that are a) contained fully within, b) cross over the perimeter of and c) are completely outside, and all scenarios return a false result. I get this result whether I call geometry1.touches(geometry2) or geometry2.touches(geometry1).


To further confirm, if I call geometry1.within(geometry2) then I get the expected results of false if geometry1 is outside geometry2 or partially outside, and true if it is fully inside. I would expect that a geometry "within" therefore definitely "touches".


I also tried geometry.touches(geometry), assuming that this would return true because the two parameters are exactly the same but still got a false result.


As a workaround, I can use the intersect method and test whether it is valid:

if (geometry1.intersect(geometry2).valid){ //do something }

Can anyone else confirm whether the "touches" method is working for them or not?