I use the following code to check if a point feature is within a polygon feature
pFeaBlock is a polygon feature and Fea is a point feature
int blockID = -1;IFeatureCursor pBlockCursor = this._blockLayer.Search(null, false);IFeature pFeaBlock = pBlockCursor.NextFeature();while (pFeaBlock != null){ if (!pFea.Shape.IsEmpty) { IPolygon pPolygon = (IPolygon)pFea.Shape; IRelationalOperator pRelOperator = (IRelationalOperator)pPolygon; if (pRelOperator.Within(pFeaBlock.Shape) == true) { blockID = (int)pFeaBlock.get_Value(2); } } pFeaBlock = pBlockCursor.NextFeature(); }but I always get he COMException on
if (pRelOperator.Within(pFeaBlock.Shape) == true)Is anyone familiar this interface?Thanks in advance
أكثر...
pFeaBlock is a polygon feature and Fea is a point feature
int blockID = -1;IFeatureCursor pBlockCursor = this._blockLayer.Search(null, false);IFeature pFeaBlock = pBlockCursor.NextFeature();while (pFeaBlock != null){ if (!pFea.Shape.IsEmpty) { IPolygon pPolygon = (IPolygon)pFea.Shape; IRelationalOperator pRelOperator = (IRelationalOperator)pPolygon; if (pRelOperator.Within(pFeaBlock.Shape) == true) { blockID = (int)pFeaBlock.get_Value(2); } } pFeaBlock = pBlockCursor.NextFeature(); }but I always get he COMException on
if (pRelOperator.Within(pFeaBlock.Shape) == true)Is anyone familiar this interface?Thanks in advance
أكثر...