I’m pretty sure I’ve everything right. can you please check it for me. it gives me this error in the console:” Uncaught Error: 0 value is not correct for the function (translated from another language)”
function map_load() {
var draw;
var coords = Array(23.078412614088098, 57.33448100333726,
23.07858534246487, 57.33415377383744,
23.078234950383354, 57.33415913825547,
23.078190534420507, 57.334582927279826,
23.07792403833525, 57.3352266574434);
var s = -2;
var triangleCoords = [];
var coords_num = coords.length/2;
for (i = 0; i < coords_num ; i++) {
s += 2;
triangleCoords[i] = google.maps.LatLng(coords[s],coords[s+1]);
}
var center1 = google.maps.LatLng(coords[0], coords[1]);
if (coords.length > 1) {
draw = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35
});
} else {
draw = new google.maps.Marker({
position: triangleCoords,
title:"your item location"
});
}
var myOptions = {
zoom: 16,
center: center1,
panControl:false,
streetViewControl:false,
mapTypeId: google.maps.MapTypeId.HYBRID
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
draw.setMap(map);
}
You’ve made the same mistake twice, missing the word ‘new’ to construct your LatLng objects.
should be
Also happens at center1
should be