ArcGIS Pro SDK export image clipped to sketched geometry

280
1
10-20-2020 11:44 AM
johnbrosowsky
Occasional Contributor

I am looking to implement a tool that exports an image of the map view clipped by a user drawn rectangle.  That is to say, draw a box around something in the map view, and export a little .BMP of only what you drew the box around.  

So far I am using sketch for this and can get the geometry of the sketched rectangle.  I can export a .BMP that is the same size as sketched rectangle which is great, but can't see how to export only what's inside the rectangle.  

Any ideas how to accomplish this via the Pro SDK?  So far I have: 

protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
return QueuedTask.Run(() =>
{
   //Create BMP format with appropriate settings
   BMPFormat BMP = new BMPFormat();
   BMP.Height = geometry.Extent.Height; 
   BMP.Width = geometry.Extent.Width;
   BMP.OutputFileName = "c:\\example\\output.bmp";
   MapView.Active.Export(BMP);
   MessageBox.Show("export complete");
return true;
});
}
}

0 Kudos
1 Reply
UmaHarano
Esri Regular Contributor

Hi,

You can use the SetClipGeomerty method on the Map to get this.

Here is a code snippet: Clip Map to the provided clip polygon

If you create a polygon feature that represents your geometry that is used to clip, you can achieve this.

Thanks

Uma

0 Kudos