Articles in this section
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.

 

GoogleMap

 

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>

 

View the sample in GitHub.

 

See also

How to view bing map using WPF SfMap

How to open street map in WPF SfMap

How to add a multiple layers in OSM map

How to show the markers in WPF SfMap

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied