Determine the number of times a polyline intersects a polygon

Discussion created by tomrip on Jul 23, 2012

I am trying to count programmatically the number of times that a polyline crosses the boundary of a polygon. On my silverlight web map, I have selected a single polygon graphic and a have drawn a polyline across the selected polygon. I am trying to verify that the polyline intersects that polygon's boundary exactly two times.

using the GeometryService.RelationAsync() method, I can tell whether the polyline intersects the polygon, but i can't figure out how to tell how many times the polyline intersects the polygon.

The basic use-case is that I am trying to Split a polygon, and the business rules state that i can only split the polygon into two pieces. That's why i need to know how many times the polyline crosses the boundary of the polygon.

Thanks for any help.