Seeking Assistance with this Issue -
For example, the initial location data appears as:
"Object
Lat: -36.768498
Lng: 174.75895"
However, an error is indicating that the latitude is not recognized as a number. Rather than making adjustments without clear understanding, this newcomer is eager to grasp why this discrepancy exists and how to resolve it :-)
var map, marker;
function initMap() {
geocoder = new google.maps.Geocoder();
var centerOfNZ = {lat: -40.8, lng: 173.0};
map = new google.maps.Map(document.getElementById('map'), {
zoom: 5.9,
center: centerOfNZ
});
markAllLocations ();
}
function markAllLocations () {
var locations = [
['Auckland','Milford Health Clinic, 50 East Coast Road, Milford', -36.768498, 174.75895],
['Christchurch', 'The George, 50 Park Terrace, Christchurch', -43.525776, 172.628387],
['Dunedin', 'Aurora on George, 678 George St, Dunedin', -45.876251, 170.502548],
['Hamilton ', 'Medcom Integrative Health Clinic, 32 O\'Neill St, Claudelands, Hamilton', -37.781234, 175.288198],
['Hawke\'s Bay', 'The Doctors Greenmeadows, 524 Kennedy Rd, Greenmeadows, Napier', -39.5229328, 176.8685695],
['Invercargill', 'The Quest Serviced Apartments, 10 Dee St, Cnr Dee and Tay Streets, Invercargill', -46.4131866, 168.3537731],
['Nelson', 'Delorenzos Apartments, 43\-55 Trafalgar St, The Wood, Nelson', -41.267575, 173.287417],
['New Plymouth', 'Quality Hotel Plymouth, Cnr of Courtney and Leach St, New Plymouth', -39.061173, 174.06889],
['Palmerston North', 'Cornwall Motor Lodge, 101 Fitzherbert Avenue, Palmerston North', -40.3596103, 175.6141897],
['Queenstown', 'Level One, 5 Duke St, Queenstown', -45.03135700, 168.65935960],
['Tauranga', '1416A Cameron Rd Greerton, Tauranga', -37.729565, 176.129608],
['Wanaka', 'C/- Janice Cleghorne, 143 Hunter Cres, Wanaka', -44.697945,169.167267],
['Wellington', 'The Quest on Thorndon, 61\-63 Thorndon Quay, Thorndon, Wellington', -41.2760045, 174.7813852],
['Whangarei', 'Distinction Whangarei Hotel, 9 Riverside Drive, Riverside, Whangarei', -35.723466, 174.327632]
];
for (let count = 0; count < locations.length; count++) {
let myPos = {
Lat : locations[count][2],
Lng : locations[count][3]
};
console.log(
count + ' ' + locations[count][0]
);
console.log(myPos);
marker = new google.maps.Marker(
{ map : map,
position: myPos,
title: locations[count][0]
}
);
}
}