Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get image from Google static map API

I use this code to generate static images from Google API, but I have too many requests, so sometimes I get overuse from Google.

string latlng = location.Latitude + "," + location.Longitude;
string path = "http://maps.googleapis.com/maps/api/staticmap?center=" + latlng +
   "&zoom=16&size=200x200&maptype=roadmap&markers=color:blue%7Clabel:S%7C" +
   latlng + "&sensor=false";

Is it possible to call this from C# to generate and save images? I can't find way to get an image object.

like image 605
1110 Avatar asked Dec 13 '22 00:12

1110


1 Answers

using (WebClient wc = new WebClient()) {
  wc.DownloadFile(url, @"c:\temp\img.png");
}
like image 118
L.B Avatar answered Jan 03 '23 02:01

L.B