-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
39 lines (34 loc) · 1.31 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Мои полигоны</title>
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU&apikey=63a8bc76-2d55-4ad4-8c7d-8051a902b1b5" type="text/javascript"></script>
<script src="polygons.js" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 100%; height: 500px;"></div>
<script>
ymaps.ready(init);
function init() {
var map = new ymaps.Map("map", {
center: [56.5091741, 52.9615513],
zoom: 14
});
// Создание полигонов на основе данных из файла polygons.js
for (var i = 0; i < polygonsData.length; i++) {
var polygonData = polygonsData[i];
var polygon = new ymaps.Polygon([polygonData.coordinates], {
hintContent: polygonData.name,
balloonContent: "Это " + polygonData.name
}, {
fillColor: polygonData.fillColor,
strokeWidth: 2,
strokeColor: polygonData.strokeColor
});
map.geoObjects.add(polygon);
}
}
</script>
</body>
</html>