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;
});
}
}
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