Answer the question
In order to leave comments, you need to log in
Why don't Yandex.Maps clusters work?
I'm trying to run some pretty simple code.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
<script src="http://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
ymaps.ready(init);
var myMap;
var myGeoObjects = [];
function init() {
myMap = new ymaps.Map("map", {
center: [55.76, 37.64],
zoom: 7
});
}
var coords = [
[56.023, 36.988],
[56.025, 36.981],
[56.020, 36.981],
[56.021, 36.983],
[56.027, 36.987]
]
for (var i = 0; i < coords.length; i++) {
myGeoObjects[i] = new ymaps.GeoObject({
geometry: {
type: "Point",
coordinates: coords[i]
}
});
}
var myClusterer = new ymaps.Clusterer();
myClusterer.add(myGeoObjects);
myMap.geoObjects.add(myClusterer);
</script>
<div id="map" style="width: 500px; height: 500px">
</div>
</body>
</html>
myGeoObjects[i] = new ymaps.GeoObject
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question