I'm trying to extract an area of interest from a raster using arcobjects (C#) to create a Server Object Extension. I can successfully get .Clip to run but it only accepts an envelope and I want to allow the user to provide a polygon for their area of interest.
Here's the code that fails and the error that I get back
//"error": {
// "code": 500,
// "message": "Error in handling operation GetAreaGreaterLessThan",
// "details": []
//}
IExtractionOp2 extractionOps = new RasterExtractionOpClass();
IGeoDataset extractedRaster = extractionOps.Polygon(rasterToQueryAsGDS, areaOfInterest, true);
Here's the alternative that kind of works but only allows an envelope and I want to use a polygon geometry
//this works
RasterTransformationOpClass rasterTransformationOpClass = new RasterTransformationOpClass();
//clip raster
IGeoDataset clippedRaster = rasterTransformationOpClass.Clip(rasterToQueryAsGDS, areaOfInterest.Envelope);
As an input the user can provide a polygon geometry (called areaOfInterest) so I'm not working with any featureclasses by default.
In another section I'm running a ReclassByRemap. Does anyone have an example on how I could use an IPolygon as a mask during the reclass rather than extracting/clipping the raster?
IReclassOp reclassOp = new RasterReclassOpClass();
// Reclassify the geodataset
IGeoDataset reclassDataset = reclassOp.ReclassByRemap(clippedRaster, remap, false);