我有一個非常奇怪的問題,似乎是最近才出現(xiàn)的。一段時間以來,我沒有對項目進(jìn)行任何重大代碼更改,而且很長一段時間都沒有對相關(guān)功能進(jìn)行任何更改。因此出現(xiàn)了問題,當(dāng)我使用API向Google Map中添加多個圖標(biāo)時,這些圖標(biāo)會彼此重疊顯示。我有一個非常奇怪的問題,似乎是最近才出現(xiàn)的。一段時間以來,我沒有對項目進(jìn)行任何重大代碼更改,而且很長一段時間都沒有對相關(guān)功能進(jìn)行任何更改。因此出現(xiàn)了問題,當(dāng)我使用API向Google Map中添加多個圖標(biāo)時,這些圖標(biāo)會彼此重疊顯示。項目網(wǎng)站上的Google Screen Capture奇怪的是,所有標(biāo)簽都正確定位,但它們使用的坐標(biāo)與圖標(biāo)相同。這是傳遞給函數(shù)的字符串1344, 52.65665917, -2.49004717, '../Images/Icons/Direction/container_blueN.ico', 'Galahad', '2014 Mar 05 Wednesday, 14:00', 'Wellington Road, Horsehay, Hollybank', 'RESERVED', '0 KPH', 0該功能是function AddClusterLocation(FID, latitude, longitude, Icon, ID, DateStamp, Location, Event, Speed, IgnitionStatus) {if (objMap) { var cssName = 'MarkerIgnitionOff'; switch (IgnitionStatus) { case '1': cssName = 'MarkerIgnitionOn'; break; default: cssName = 'MarkerIgnitionOff'; } var adjustedIcon = new google.maps.MarkerImage( Icon, new google.maps.Size(32, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 16) ); var objMarker = new MarkerWithLabel({ position: new google.maps.LatLng(latitude, longitude), draggable: false, raiseOnDrag: false, icon: adjustedIcon, map: objMap, labelContent: ' ' + ID + ' ', labelAnchor: new google.maps.Point(-8, -8), labelClass: cssName, // the CSS class for the label labelStyle: { opacity: 1.0 } });由于標(biāo)簽正確,我真的不知所措,我每次調(diào)用函數(shù)時都要檢查緯度和經(jīng)度及其不同之處。加上這是有效的,直到昨天才被客戶發(fā)現(xiàn)不是。這是我使用的API<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>感謝您閱讀問題,希望能對您有所幫助!
Google Map API-錯誤位置有多個圖標(biāo)
喵喵時光機(jī)
2019-11-21 09:39:42