We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show google map in WPF Map (SfMap)

Platform: WPF |
Control: SfMaps |
Published Date: September 15, 2020 |
Last Revised Date: September 15, 2020

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

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile