iHitTest  :: finding boundary intersection from inside a polygon

539
4
09-11-2012 09:01 AM
JasonStradtner
New Contributor II
I just want to make sure that I am understanding the capabilities correctly.

My point falls inside a polygon.  I want to find the distance to the closest intersection between the point and the polygon boundary.

So if i use the polygon as the geometry and I use the esriGeometryHitPartType.esriGeometryPartBoundary Type, will hitTest return the closest boundary intersection to the polygon that the point falls inside of?

TIA!
0 Kudos
4 Replies
DuncanHornby
MVP Notable Contributor
Jason,

If you want to find the distance only then try using the IProximityOperator Interface, a lot easier to use (i.e. less parameters to worry about). Although a Point in a polygon will return zero so you will want to cast your polygon into a polyline.

Duncan
0 Kudos
JasonStradtner
New Contributor II
Thanks Duncan.  I do need the intersection point though for other operations.  I just wanted to make sure that iHitTest would be able to find the boundary when the point falls inside the polygon geometry.  Maybe the iHitTest type specifies that the polygon gets cast to a line automatically?
0 Kudos
DuncanHornby
MVP Notable Contributor
The same interface offers this method QueryNearestPoint that will give you the point.
0 Kudos
JasonStradtner
New Contributor II
OK, but going back to the original question, can iHitTest do these things with a polygon when the point falls inside?  i guess i could just try it, but was curious if anyone else already knew.
0 Kudos