I am building an application that needs a tool for rendering a geographic map, in addition the application needs the tool to provide a way for adding custom overlays.
I found GMap.Net to be a great tool for the job.
I found a lot of WinForm
examples on the web which creates custom overlays, for example:
GMapOverlay markersOverlay = new GMapOverlay("markers");
GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-25.966688, 32.580528), GMarkerGoogleType.green);
markersOverlay.Markers.Add(marker);
gmap.Overlays.Add(markersOverlay);
But when I approached to the WPF
version of GMap.Net I noticed that overlays are gone and I am forced to add markers straight to the markers collection (mymap.Markers.Add(new Marker())
) without the ability to composite the markers in an separate overlay.
How do I use overlays in the Wpf version of GMap.Net?
The solution is to implement an overlay collections by yourself. Keep a collection of markers that share the same ZIndex
as one overlay and a collection that holds all the overlays.
I wish it was like in the WinFrom
version.