我目前在我的網站上使用下面的代碼顯示它並將標記放置在地圖上。更改特定谷歌地圖標記的顏色
// Creating a new map
//UK Cordinates 55.37911,-3.427734 zoom 9
var map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(54.901882,-3.603516),
zoom: 6,
panControl: false,
scrollwheel: false,
mapTypeControl: false,
streetViewControlOptions: {position: google.maps.ControlPosition.LEFT_CENTER},
zoomControlOptions: {position: google.maps.ControlPosition.LEFT_CENTER},
mapTypeId: google.maps.MapTypeId.ROADMAP
// Creating the JSON data
var json = [
{
"title": "BLAH",
"lat": 51.514979,
"lng": -0.134175,
"description": "BLAHBLAHBLAH"
},
{
"title": "BLAH",
"lat": 51.512779,
"lng": -0.132625,
"description": "BLAHBALH"
},
{
"title": "BLAH",
"lat": 51.489025,
"lng": -0.191840,
"description": "BLAHBLAH"
},
我想只使某些標記顯示爲綠色而不是標準紅色。 但是,並非通過放置標記的方法(JSON數據),有很多關於如何在Web上執行此操作的信息。 以前的設計師做了這個,所以我不確定!
非常感謝!
這將有助於看到您的JavaScript代碼,你實際上遍歷該JSON數據並創建標記[顏色一個谷歌的第一標記圖譜不同的顏色(HTTP的 – duncan
可能重複://計算器。 com/questions/16900210/color-the-first-marker-of-google-map-a-different-color) – geocodezip