ThinkGeo.com    |     Documentation    |     Premium Support

How to use the GoogleMapsOverlay in Map Suite Desktop Edition 3.0?

Yale,


I  want to disaply the Goole Map  satllites as my backgroud layer.How can I do that ? I used the GoogleMapsOverlay class.


The follwing is my codes:


                     winformsMap1.MapUnit = GeographyUnit.Meter;

                 GoogleMapsOverlay googleOverlay = new GoogleMapsOverlay(@"ABQIAAAAoxK_HcqphMsnUQHEwLwHlRSavkNJi0NVTgm4UDidoiIU5dUJpRQW88FufPCp0aTPraxZgZFAIUHn3Q");

                googleOverlay.MapType = GoogleMapsMapType.Satellite;

                googleOverlay.CacheDirectory = Path.Combine(@"D:\Tiles", "Google");  

                winformsMap1.Overlays.MoveToBottom(winformsMap1.Overlays.IndexOf(googleOverlay));

                winformsMap1.ZoomLevelSet = new GoogleMapZoomLevelSet();

                winformsMap1.CenterAt(0, 0);

                winformsMap1.ZoomToScale(winformsMap1.ZoomLevelSet.ZoomLevel03.Scale);

                winformsMap1.Refresh(); 




But there is a WebException error,it said that "The remote server, feedback error, (403) Forbidden ".

firstly I think maybe it the network bad,but I found my network is fine. there is so less information about GoogleMapsOverlay class that  I can not known what cause it. I think maybe it may be is the gaoole license Key  is wrong . then I signed up a key  with " My web site URL:" as "localhost". But with the new key ,the application still works badly .there still is  a WebException error,it said that "The remote server, feedback error, (403) Forbidden ".

How can I resovle this problem?I'm excepting your reply! thanks very much !



Senlin,


The following code can work exactly right on my enviroment. Could you try this? And if still problem exists, could you let me know which version you are using by using:

        WinformsMap.GetVersion();

        private void DisplayMap_Load(object sender, EventArgs e)
        {
            
            winformsMap1.MapUnit = GeographyUnit.Meter;
            GoogleMapsOverlay googleOverlay = new GoogleMapsOverlay(@"ABQIAAAAoxK_HcqphMsnUQHEwLwHlRSavkNJi0NVTgm4UDidoiIU5dUJpRQW88FufPCp0aTPraxZgZFAIUHn3Q");
            googleOverlay.MapType = GoogleMapsMapType.Satellite;
            googleOverlay.CacheDirectory = Path.Combine(@"C:\GoogleCache", "Google");

            winformsMap1.Overlays.Add("googleOverlay", googleOverlay);
            winformsMap1.Overlays.MoveToBottom(winformsMap1.Overlays.IndexOf(googleOverlay));
            
            winformsMap1.ZoomLevelSet = new GoogleMapZoomLevelSet();
            winformsMap1.CenterAt(0, 0);
            winformsMap1.ZoomToScale(winformsMap1.ZoomLevelSet.ZoomLevel04.Scale);
            winformsMap1.Refresh(); 
        }

 

Any more questions please just feel free to let me know.
 
Thanks.
 
Yale