Привет, я новичок в API карт Google и пытаюсь создать карту, на которой значок отображается в определенных местах для определения продаж, но я не могу изменить размер значка! Я уже пытался создать переменную с иконкой и пытался изменить ее размер, но я думаю, что Google обновился, и метод, который я попробовал, больше не работает!
МОЙ КОД:
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* 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;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 38.736946, lng: -9.142685},
zoom: 5,
});
// Look Icon
var iconLook = {
url: "look.png", // url
scaledSize: new google.maps.Size(50, 50), // scaled size
origin: new google.maps.Point(0,0), // origin
anchor: new google.maps.Point(0, 0) // anchor
};
// Critic Icon (COMING SOON)
var iconCritic = {
url: "critic.png"
scaledSize: new google.maps.Size(10, 10),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(0, 0)
};
// NEW MARKER
var MarkerPorto = new google.maps.Marker({
position: {lat: 38.736946, lng: -9.142685},
map:map,
icon: iconLook
})
MarkerPorto.setMap(map);
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=[[NOT GIVING MY API]]&callback=initMap" async defer></script>
</body>
</html>
ОШИБКА В КОНСОЛИ:
Uncaught SyntaxError: Unexpected identifier map.html:42
И
Uncaught (in promise) Kc {message: "initMap is not a function", name: "InvalidValueError", stack: "Error↵ at new Kc (https://maps.googleapis.com/[[MY API AGAIN]]&callback=initMap:124:108"}