我使用 Google API 来绘制标记和多边形。这很好用,但我似乎无法让多边形的 fillOpacity 和 strokeOpacity 工作。它在设置为 0 或 1 时有效,这让我相信存在某种解析错误。(我在下面的代码中省略了细节,只是用示例替换了它)
<script type="text/javascript">
var locations = [
['EXAMPLETEXT, EXAMPLECOORDINATE1, EXAMPLECOORDINATE2, 1],
];
var limburgcoordinaten = [
new google.maps.LatLng(EXAMPLECOORDINATE1, EXAMPLECOORDINATE2),
new google.maps.LatLng(EXAMPLECOORDINATE1, EXAMPLECOORDINATE2),
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 8,
center: new google.maps.LatLng(EXAMPLECOORDINATE1, EXAMPLECOORDINATE2),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
var limburg = new google.maps.Polygon({
paths: limburgcoordinaten,
strokeColor: "#FF0000",
strokeOpacity: 0.7,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.3,
map: map
});
}
我希望我只是在看一些非常明显的东西!