I want to find out if a point is within the area bounded by a polygon. Here's what got so far:IRelationalOperator2 pointRelationalOperator = MyPoly as IRelationalOperator2;
bool ok = pointRelationalOperator.Within(MyPoly as IGeometry); //this is ok the polygon contains itself
bool ok = pointRelationalOperator.Contains(MyPoly as IGeometry); //this is also okNext convert Polygon into a PointCollection, grab a point, and see if that point is "within()" the polygon.
IPointCollection4 pc4 = MyPoly as IPointCollection4;
for (int i = 0; i < pc4.PointCount; i++)
{
IPoint thisPoint = pc4.get_Point(i);
bool isPointInPolygon = pointRelationalOperator.Within(thisPoint); //tried both Within and Contains
isPointInPolygon = pointRelationalOperator.Contains(thisPoint);
}
isPointInPolygon is always false. 😞 The polygon is non-empty, it is closed and it returns a length and has 347 points.Fyi, I am creating the polygon by loading up a shape file, then merging all the feature classes into one polygon according to this tutorial, http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000009t000000