проблемаGoogle Map маркер не работает
мне нужно реализовать более одного маркера на карте Google.
маркер не отображается на карте google.
HTML код
<span class="latitude" data-val={{value.latitude}} value={{value.latitude}} data-long={{value.longitude}} data-name="{{value.name}}"></span>
код расслоение плотной
var zindex = 0;
var locations = [];
$.each($('.latitude'), function(index, value) {
//console.log($(this).data('val'));
var lat = $(this).data('val');
var longs = $(this).data('long');
locations.push($(this).data('name'));
locations.push($(this).data('val'));
locations.push($(this).data('long'));
locations.push(zindex);
console.log(locations);
// console.log("---------");
// console.log(longs);
// console.log(zindex);
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(lat, longs),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
html: locations[0],
//icon: image
});
console.log(locations[i]);
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
zindex++;
});
JSON
["Conference Planning Meeting", 25.788969, -80.226439, 0, "Darwin Festival", -12.462827, 130.841777, 1, "Indiana State Fair", 39.768403, -86.158068, 2, "ICTP-CIMPA Advanced School", "-13.525000", -71.972222, 3, "HR Management MBA", 25.271139, 55.307485, 4, "10-day Finance & Accounting MBA", 25.271139, 55.307485, 5, "Leadership and Management Skills for the 21st Century", 51.511214, -0.119824, 6, "Results-Based Management and Performance Indicators", "45.508670", -73.553993, 7, "Capital Budgeting and Financial Management in the Public Sector", "45.508670", -73.553993, 8, "IDPM Accreditation Training Session", "45.508670", -73.553993, 9, "PPMS Accreditation Training Session", "45.508670", -73.553993, 10, "Erie County Fair", 42.715893, -78.829477, 11, "International Conference of Physics Students", 45.813029, 15.977895, 12, "Iowa State Fair", 41.600545, -93.609106, 13, "Illinois State Fair", 42.101483, -72.589811, 14, "Missouri State Fair", 38.704461, -93.228261, 15, "West Virginia State Fair", 40.964529, "-76.884410", 16, "Central States Fair", 44.080543, -103.231015, 17, "Wilson County Fair", "36.208110", -86.291102, 18, "Miami County Fair", 42.605589, "-83.149930", 19, "Montgomery County Agricultural Fair", 39.143441, -77.201371, 20, "Flowers And Honey All Year Round", "59.934280", 30.335099, 21, "School Fair", 47.026859, 28.841551, 22, "Singapore World Stamp Exhibition", 1.280095, 103.850949, 23, "Wilderness Medicine Conference", -33.867487, "151.206990", 24…]
- я м не удалось найти вопрос любое предложение можно только приветствовать ,
- У меня есть код с сайта stackoverflow.
Просьба [Minimal, Complete, испытана и читаемый примера] (http://stackoverflow.com/help/mcve), который демонстрирует проблему. – geocodezip