-1
我很努力去理解這一點。Google地圖標記位置錯誤
我的代碼如下,連同一個測試頁面的鏈接,顯示地圖 標記錯誤的地方。
一致正如你可以從他們55.8353173和-3.9854019
但是鏈接看到,當我將它們包括在下面我的代碼 - 標記出現在錯誤的地方。 請參閱http://craigfagan.com/queenslie/testmap.html
我的代碼如下。
任何幫助將非常感謝 - 抓我的頭想知道我做錯了什麼?
預先感謝任何建議..
<div id="map"></div>
<script type="text/javascript">
function initMap() {
var mapOptions = {
zoom: 17,
scrollwheel: false,
center: new google.maps.LatLng(55.8353173,-3.9854019),
styles:
[{"featureType":"water","elementType":"geometry.fill","stylers":
[{"color":"#d3d3d3"}]},{"featureType":"transit","stylers":
[{"color":"#808080"},{"visibility":"off"}]},
{"featureType":"road.highway","elementType":"geometry.stroke",
"stylers":
[{"visibility":"on"},{"color":"#b3b3b3"}]},
{"featureType":"road.highway","elementType":"geometry.fill","stylers":
[{"color":"#ffffff"}]},
{"featureType":"road.local","elementType":"geometry.fill","stylers":
[{"visibility":"on"},{"color":"#ffffff"},{"weight":1.8}]},
{"featureType":"road.local","elementType":"geometry.stroke","stylers":
[{"color":"#d7d7d7"}]},
{"featureType":"poi","elementType":"geometry.fill","stylers":
[{"visibility":"on"},{"color":"#ebebeb"}]},
{"featureType":"administrative","elementType":"geometry","stylers":
[{"color":"#a7a7a7"}]},
{"featureType":"road.arterial","elementType":"geometry.fill","stylers":
[{"color":"#ffffff"}]},
{"featureType":"road.arterial","elementType":"geometry.fill","stylers":
[{"color":"#ffffff"}]},
{"featureType":"landscape","elementType":"geometry.fill","stylers":
[{"visibility":"on"},{"color":"#efefef"}]},
{"featureType":"road","elementType":"labels.text.fill","stylers":
[{"color":"#696969"}]},
{"featureType":"administrative","elementType":"labels.text.fill",
"stylers":
[{"visibility":"on"},{"color":"#737373"}]},
{"featureType":"poi","elementType":"labels.icon","stylers":
[{"visibility":"off"}]},
{"featureType":"poi","elementType":"labels","stylers":
[{"visibility":"off"}]},
{"featureType":"road.arterial","elementType":"geometry.stroke",
"stylers":
[{"color":"#d6d6d6"}]},
{"featureType":"road","elementType":"labels.icon","stylers":
[{"visibility":"off"}]},{},
{"featureType":"poi","elementType":"geometry.fill","stylers":
[{"color":"#dadada"}]}]
};
var mapElement = document.getElementById('map');
var map = new google.maps.Map(mapElement, mapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(55.8353173,-3.9854019),
map: map,
title: 'Dakota'
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyDJRdPso7qlkubRB66DafdHiBClCZoGGsI&callback=initMap" async
defer></script>
鏈接中的座標是地圖的中心,而不是標記。 – geocodezip
謝謝 - 你知道我如何得到標記的座標嗎? – CraigDev
有幾種方法,第一個問題是您想使用Google Maps還是Places API來獲取座標? – geocodezip