'Placement of drawn map on Google Maps
On https://delr.dk/nyheder/ i have placed a drawn map of a city. The only way i can place it is by guessing the imagebounds which isn't very exact.
Im initializing the map by the following code:
const fairmap = document.getElementById("firmap");
const tilt = 65;
const heading = 310;
const map = new google.maps.Map(fairmap, {
zoom: 17,
center: { lat: 55.23773150087892, lng: 10.531350331799581 },
heading: heading,
tilt: tilt,
mapId: "9e102c6145fa2e82",
mapTypeControl: false,
streetViewControl: false
});
const imageBounds = {
north: 55.24773150087892,
south: 55.22773150087892,
east: 10.571350331799581,
west: 10.511350331799581,
};
historicalOverlay = new google.maps.GroundOverlay(
pathtoimage,
imageBounds);
historicalOverlay.setMap(map);
map.fitBounds(historicalOverlay.getBounds());
Is there a way of placing a drawing exactly on Google Map and then extract the imagebounds.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|