JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="map"></div>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBYkokiNLc6ksDgKlkI0aLuhF9Lwbl1dX0&callback=initMap"></script>
</body>
CSS
/* 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;
}
JavaScript
'use strict'
var panorama;
function initMap() {
var s = {
markerURL: 'https://www.immediateentourage.com/ie/wp-content/uploads/2011/10/Wind+Turbine+Original+Photo+by+Eclipse.sx_2.png', // url of the marker
scaleFactor: 1.5, // marker scale factor
maxDistance: 1500, // max distance at which the marker is still visible (meter)
}
// positions of the windmills
var mill_pos = [
{lat: 53.284068, lng: 6.372359},
{lat: 53.281593, lng: 6.371393},
{lat: 53.281927, lng: 6.371424},
{lat: 53.282388, lng: 6.371357},
{lat: 53.282926, lng: 6.371250},
{lat: 53.283299, lng: 6.371261},
];
// 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
});
// find size of original image and apply factor
var size = getSize(s.markerURL, function(size){
size.width = size.width*s.scaleFactor;
size.height = size.height*s.scaleFactor;
// create the custom windmill marker
var pinIcon = new google.maps.MarkerImage(
s.markerURL,
null, /* size is determined at runtime */
null, /* origin is 0,0 */
null, /* anchor is bottom center of the scaled image */
new google.maps.Size(size.width, size.height)
);
// place the markers
var mill_markers = [];
mill_pos.forEach(function(pos){
mill_markers.push(new google.maps.Marker({
position: pos,
map: map,
icon: pinIcon,
title: 'Windmolen EAZ'
}))
})
});
// 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);
}
function getSize(url, res){
var img = new...