Click here to Skip to main content
13,143,008 members (52,463 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 6 Aug 2012
Copyright © CodeProject, 1999-2017
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