我需要帮助创建地理位置标记
编码:
var latLong = response._source.misc.latLong;
console.log(latLong);
var getaddress = response._source.misc.address;
showPosition(latLong);
function showPosition(geolocation) {
var img_url = "http://maps.googleapis.com/maps/api/staticmap?center="
+geolocation+"&zoom=14&size=400x300&sensor=false";
document.getElementById("mapholder").innerHTML = "<img src='"+img_url+"'>";
}
答案 0 :(得分:0)
您缺少静态地图网址的标记参数。
查看以下示例。
https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284
标记添加为“marker = color:green%7Clabel:G%7C40.711614,-74.012318”
你应该做那样的事情。示例http://jsfiddle.net/122cgs5y/