/
polyline.html
48 lines (43 loc) · 1.31 KB
/
polyline.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
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Минимальный проект</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://api-maps.yandex.ru/2.1/?apikey=API-ключ&lang=ru_RU" type="text/javascript">
</script>
<script type="text/javascript">
ymaps.ready(init);
function init(){
let myMap = new ymaps.Map("map", {
center: [55.76, 37.64],
zoom: 9
});
// создаём первую ломаную линию и указываем ей толщину в 5 пикселей
let myPolyline1 = new ymaps.GeoObject({
geometry: {
type: "LineString",
coordinates: [
[55.40, 37.40],
[55.20, 37.44],
[55.60, 37.50]
]
}
},{
strokeWidth: 5
});
// создаём вторую ломаную линию
let myPolyline2 = new ymaps.Polyline([
[55.80, 37.30],
[55.80, 37.40],
[55.70, 37.30]
]);
// добавляем объекты на карту
myMap.geoObjects.add(myPolyline1);
myMap.geoObjects.add(myPolyline2);
}
</script>
</head>
<body>
<div id="map" style="width: 600px; height: 400px"></div>
</body>
</html>