Click here to Skip to main content
11,575,921 members (59,109 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF Google-Maps
Hi ,
Im writing a WPF app to display the map from google maps api.
I was successfuly able to get info from google weather but google maps im not able to display.I dono what is exact reason.

Below is the snippet.

 string url = @"http://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false";
            WebRequest webrequest = WebRequest.Create(url);
            WebProxy proxy = new WebProxy(addressVar);//, 8080);
            proxy.Credentials = CredentialCache.DefaultCredentials;
            webrequest.Proxy = proxy;
            //XmlTextReader reader = new XmlTextReader(webrequest.GetResponse().GetResponseStream());
            BitmapImage bitmap1 = new BitmapImage();
            bitmap1.BeginInit();
            bitmap1.UriSource = new Uri(url);
            bitmap1.EndInit();
            
            imageMap.Source = bitmap1;
Posted 2-Aug-12 21:42pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

To complement Kenneth's answer, here's how you'd do it in C#;
string url = @"http://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false";
 
BitmapImage bmpImage = new BitmapImage();
bmpImage.BeginInit();
bmpImage.UriSource = new Uri(mapURL);
bmpImage.EndInit();
 
MapImage.Source = bmpImage; 
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is an article that pulls google pictures from the web to display it in a WPF program, the source is written in VB.net but there sould be many hints on how to do it here:
WPF Map App: WPF Meets Google Geocoding and Static Maps APIs[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 330
1 F-ES Sitecore 145
2 OriginalGriff 125
3 Dave Kreskowiak 120
4 Abhinav S 98
0 OriginalGriff 705
1 Sergey Alexandrovich Kryukov 600
2 Abhinav S 438
3 F-ES Sitecore 410
4 Suvendu Shekhar Giri 365


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 6 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100