2010-05-11 79 views

回答

0

如前所述静态地图API版本2 这里有一个很好的文档: https://developers.google.com/maps/documentation/staticmaps/

至少,这是我的一个快速搜索后快速理解。我创建静态地图的唯一时间通常是在方向页的末尾,我已经创建了一个交互式地图。我有“StaticMap”的ID的DIV,然后我用这个函数:

function makeStaticMap(Destination,LatLon) 
{ 
    Dest = Destination.split(","); 
    Dest[0] = Dest[0].replace(/ /gi, "+"); 
    Dest[1] = Dest[1].replace(/ /gi, "+"); 
    var StaticLink = '<img src="http://maps.google.com/maps/api/staticmap?center='+Dest[0]+','+Dest[1]+','+Dest[2]+'&zoom=16&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:%7C'+LatLon+'&sensor=false" />'; 
    var LinkDiv = document.getElementById("StaticMap"); 
    LinkDiv.innerHTML = StaticLink; 
} 

凡LatLon,当然,是一个逗号分隔的字符串和目标是“地址,城市,州,邮编”。

希望这会有所帮助。

相关问题