How to get image from Google static map API

自闭症网瘾萝莉.ら 提交于 2019-12-21 17:29:19

问题


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.


回答1:


using (WebClient wc = new WebClient()) {
  wc.DownloadFile(url, @"c:\temp\img.png");
}


来源:https://stackoverflow.com/questions/11594702/how-to-get-image-from-google-static-map-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!