我正在使用Google Maps API v3(街景)来“预览”某个位置的风力涡轮机的外观。我目前正在使用带有自定义图像的标记在地图上显示风力涡轮机。这一切都按预期工作,风车出现,看起来很不错。但是,当我离得更远时,某些标记不再显示。 (见链接)
One of the turbines no longer displays.. :(
是否有人知道是否可以在更长的距离上显示标记?
我在Google地图中修改了StreetView标记示例。
编辑: 我基本上想要实现的是让标记显示更长的距离。现在发生的事情是当你离标记足够远时,它就不再呈现了。
var panorama;
function initMap() {
// positions of the windmills
var mill_pos = [
{lat: 53.281593, lng: 6.371393},
{lat: 53.281927, lng: 6.371424},
{lat: 53.282388, lng: 6.371357},
{lat: 53.282926, lng: 6.371250},
];
// start position
var startPos = {lat: 53.281413, lng: 6.371178};
// Set up the map
var map = new google.maps.Map(document.getElementById('map'), {
center: startPos,
zoom: 18,
streetViewControl: false
});
// place the markers
var mill_markers = [];
mill_pos.forEach(function(pos){
mill_markers.push(new google.maps.Marker({
position: pos,
map: map,
icon: 'https://www.immediateentourage.com/ie/wp-content/uploads/2011/10/Wind+Turbine+Original+Photo+by+Eclipse.sx_2.png',
title: 'Turbine'
}))
});
// We get the map's default panorama and set up some defaults.
// Note that we don't yet set it visible.
panorama = map.getStreetView();
panorama.setPosition(startPos);
panorama.setPov(/** @type {google.maps.StreetViewPov} */({
heading: 0,
pitch: 0
}));
panorama.setVisible(true);
}
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#floating-panel {
position: absolute;
top: 10px;
left: 25%;
z-index: 5;
background-color: #fff;
padding: 5px;
border: 1px solid #999;
text-align: center;
font-family: 'Roboto','sans-serif';
line-height: 30px;
padding-left: 10px;
}
#floating-panel {
margin-left: -100px;
}
<body>
<div id="map"></div>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBYkokiNLc6ksDgKlkI0aLuhF9Lwbl1dX0&callback=initMap"></script>
</body>
https://jsfiddle.net/4f9bwxfc/
如果有人知道如何解决这个问题会很棒!