AnsweredAssumed Answered

Rendering a map off-screen

Question asked by ahigh2 on Feb 11, 2016
Latest reply on Feb 15, 2016 by ahigh2

Hello,

 

Previously using the ArcGIS WPF Runtime I could create and initialize a map off-screen and render it to a bitmap using RenderTargetBitmap. I'm wondering if there is a preferred method to doing this as I'm currently unable to get a MapView to render unless it's in view, which isn't an option for this use case.

 

// Sample code

Grid grid = new Grid(){Width=width, Height=height};

 

Map map = new Map(){Width=width, Height=height};

map.Layers.Add(someLayer);

 

grid.Children.Add(map);

grid.Measure(new Size(width, height));

grid.Arrange(new Rect(new Size(width, height)));

grid.UpdateLayout();

 

map.Extent = someExtent;

 

RenderTargetBitmap rtb = new RenderTargetBitmap(width, height, dpi, dpi, PixelFormats.Default);

rtb.Render(grid);

 

// Do something with the image here

 

// End Sample

 

The sample above is a simplified version of what I'm doing, but the fundamentals are the same. In the .NET 10.2.7 runtime this results in blank images. How can I recreate this behavior in the .NET Runtime? It appears that the map is never initialized unless I bring it into view.

Thanks,

Aaron

Outcomes