我正在尝试在 asp.net 中生成 gmap 图像。我需要指定不同的纬度和经度,并使用折线生成谷歌地图图像。到目前为止,我可以使用以下代码创建图像:
protected void btnMap_Click(object sender, EventArgs e)
{
Save_Image("http://maps.google.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue|label:S|40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false");
}
private void Save_Image(string URL)
{
WebClient client = new WebClient();
string strFileName = DateTime.Now.GetHashCode().ToString() + ".png";
client.DownloadFile(URL, Server.MapPath("~/images/" + strFileName));
imgGmap.ImageUrl = "~/images/" + strFileName;
}
我无法找到在此网址中传递经度和纬度的方法。我检查了这个做同样事情的博客,但我没有找到用这个演示生成图像的方法。