I am creating an Envelope with specific latitude and longitude bounds, zooming the MapView to that envelope, then exporting a BMPFormat image of the MapView. I am setting the BMPFormat to a specific height and width. What I am expecting, is an image with the full bounds of the Envelope, and only the envelope in the resulting bmp file. It seems like the resulting image is not the full bounds of the envelope, but just a portion of it. Is it possible to achieve what I want, and if so, what am I missing?
BMPFormat BMP = new BMPFormat() { Height = info.getResolutionHeight(), Width = info.getResolutionWidth(), HasWorldFile = true, OutputFileName = MapImagePath };MapView mapView = MapView.Active; Envelope envelope = EnvelopeBuilderEx.CreateEnvelope(info.getLongitude(), info.getLatitude(), info.getLongitude() + info.getLongitudeSpan(), info.getLatitude() + info.getLatitudeSpan(), ArcGIS.Core.Geometry.SpatialReferenceBuilder.CreateSpatialReference(4326));// wm:3857 , pc": 4326 mapView.ZoomTo(envelope); // Write the bmp file to disk if (mapView != null) { //Export on the worker thread await QueuedTask.Run(() => { //Check to see if the path is valid and export if (BMP.ValidateOutputFilePath()) { mapView.Export(BMP, mapView.Camera); //Export to BMP } }); }
Solved! Go to Solution.
Hi,
You can call another overload of Export method with envelope parameter:
mapView.Export(BMP, envelope); //Export to BMP
Hi,
You can call another overload of Export method with envelope parameter:
mapView.Export(BMP, envelope); //Export to BMP
I am still seeing an issue with this. It seems like the exported image contains portions of the map outside the bounds of the envelope. I am looking at the exported world file (.bpw) and although I have not found any documentation on the world file itself it looks like the last 2 lines are a longitude and latitude that is outside of the bounds of the Lat/Lon used to create the envelope, and the resulting image seems to reflect this as well. Is it possible to only export the bounds of the envelope?