Category / Section
How to show google map in WPF Map (SfMap)
1 min read
This article explains how to use google maps API to show that in Syncfusion WPF SfMap as shown in the following image.
Display the Google Maps
Step 1
Extend the ImageryLayer class and overriding the GetUri method and pass the google map tile Uri on it with their X, Y and Scale values as shown in the following code sample.
[C#]
public class ImageryLayerExt : ImageryLayer { protected override string GetUri(int X, int Y, int Scale) { var link = "http://mt1.google.com/vt/lyrs=y&x=" + X.ToString() + "&y=" + Y.ToString() + "&z=" + Scale.ToString(); return link; } }
Step 2
Added the extended ImageryLayer (ImageryLayerExt) to its layers collection of maps to render the map control OSM layer as shown in the following code sample.
[XAML]
<sync:SfMap> <sync:SfMap.Layers> <local:ImageryLayerExt> </local:ImageryLayerExt> </sync:SfMap.Layers> </sync:SfMap>