我想在我的網站的Google地圖上顯示帶有圖標和標籤的自定義位置。Google Maps API - 顯示/添加自定義位置(標記)
回答
在頭部插入以下JS庫和編碼。更改LatLng以匹配您的確切位置。
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(7.316306, 80.622160);
var mapOptions = {
zoom: 14,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'My new location is this :P'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
然後在正文部分插入此div以顯示地圖。
<div id="map-canvas" width="350" height="271"></div>
我想把我的位置鏈接,而不是LatLng。 – webber
ooops !!!!只需將您的示例中的值(7.31 ...&80.62 ...)替換爲您的自己的值指向您的確切位置。您可以通過右鍵單擊 - >我的位置從Google地圖中找到確切值。 –
這是鏈接,我想將確切的地圖顯示到我的網站中.https:// www .google.com /地圖/ DIR /豪拉,+站+路+豪拉鐵路+ +站+西+孟加拉,+印度/南亞+市+購物中心+ 375,+王子+安瓦爾+沙+路+ !賈達普,+加爾各答,+西+孟加拉+ 700068,+印度/ @ 22.5440264,88.3041789,13z /數據= 3M1 4B1 4m14 4m13 1M5 1M1 1s0x3a027795d8ab719b:!!!!!!!!!0x45ef375a63fd05f32平方米1d88.3412374 2d22.5841579 !1m5!1m1!1s0x3a0270d861b6d22b:0xee3d107a198d3cdf!2m2!1d88.3618516!2d22.5014411!3e0 – webber
- 1. 如何在Google Maps API標記上添加自定義標題?
- 2. Google Maps API自定義標記
- 3. 顯示Google Maps API標記的位置信息
- 4. Google Maps API V2標記未顯示在正確的位置
- 5. Google Maps API:未定義標記標題
- 6. Google Maps JavaScript API地理位置標記
- 7. 由於未定義變量,Google Maps API V3標記未顯示
- 8. Google Maps API不顯示所有標記
- 9. Google Maps API:未顯示標記
- 10. 使用Google Maps API顯示標記
- 11. Google Maps API標記不顯示
- 12. 未顯示Google Maps API v3標記
- 13. knockoutjs Google Maps API顯示所有標記
- 14. Google Maps API不顯示標記
- 15. react-google-maps自定義標記圖標
- 16. Google Maps API v3通過自定義圖像疊加標記?
- 17. Google Maps API v3添加地圖標記
- 18. Google Maps API(v3)添加/更新標記
- 19. Google Maps API和顯示位置
- 20. Google靜態地圖API - 自定義標記未顯示
- 21. Google Maps Api添加標籤
- 22. 在用戶的位置顯示自定義標記
- 23. 如何將自定義數據添加到標記(Google Maps API SWIFT)
- 24. 使用API v2將自定義標記添加到Google地圖
- 25. Google Maps API NativeScript自定義標記圖標
- 26. Google Map現在顯示標記是我添加自定義圖標
- 27. Google Maps API - 標記
- 28. 在Google Maps JavaScript API上自動更新標記位置
- 29. Google Maps API v3 - 自定義標記沒有出現
- 30. 如何使用Google Maps API自定義不同的標記CSS?
是否需要顯示地圖或文字鏈接 –
我想用該自定義鏈接顯示地圖。 – webber
鏈接或指針 –