Skip to content

Instantly share code, notes, and snippets.

@Shapit0
Created March 31, 2014 13:51
Show Gist options
  • Save Shapit0/9892695 to your computer and use it in GitHub Desktop.
Save Shapit0/9892695 to your computer and use it in GitHub Desktop.
var coord = $("#objmap").html();
var coords = jQuery.parseJSON(coord);
ymaps.ready(init);
var myMap;
function init(){
myMap = new ymaps.Map ("map", {
center: [59.931554, 30.316818],
zoom: 10
});
myCollection = new ymaps.GeoObjectCollection({}, {
preset: 'twirl#redIcon', //все метки красные
draggable: true // и их можно перемещать
});
// или myCollection = new ymaps.GeoObjectArray(...);
for (var i = 0; i < coords.length; i++) {
myCollection.add(new ymaps.Placemark(coords[i]));
}
myMap.geoObjects.add(myCollection);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment