I am trying to use XAML MAP control (https://xamlmapcontrol.codeplex.com/) to add a heatmap layer on a map based on OpenStreetMap from C# VS2013 WPF.
I have added the h
You may use a derived MapImageLayer and override its UpdateImage
to create a heatmap bitmap on the fly. This would of course only be a sensible approach, if creating the bitmap doesn't take too much time.
public class HeatmapImage : MapImageLayer
{
protected override void UpdateImage(
double west, double east, double south, double north, int width, int height)
{
BitmapSource bitmap = ... // create heatmap here
UpdateImage(west, east, south, north, bitmap);
}
}
You would then simply add the HeatmapImage
to the map, and you're done:
Note that the map image in the bitmap would have to be created using the Web Mercator projection.
EDIT: To give you an idea how a MapImage works, take a look at the following XAML snippet from the sample application in XAML Map Control. It displays an image with the given lat/lon bounds as an overlay in the map control. The actual image is a aerial image tile copied from Google Maps: