Help, please, on the Yandex map, display the route by segments (not taking into account roads, borders). Those. there is an array of points and you need to connect them with segments.

Closed due to the fact that the essence of the issue is incomprehensible by the participants Enikeyschik , AK ♦ , 0xdb , aleksandr barakin , freim Jan 25 at 8:02 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • I put a title in the search and gave me a solution. Minus for the lack of attempts to solve the problem. - Enikeyschik

1 answer 1

The Maps API has a tool for drawing broken lines. Sandbox example

ymaps.ready(init); function init() { // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ ΠΊΠ°Ρ€Ρ‚Ρƒ. var myMap = new ymaps.Map("map", { center: [55.72, 37.44], zoom: 10 }, { searchControlProvider: 'yandex#search' }); // Π‘ΠΎΠ·Π΄Π°Π΅ΠΌ Π»ΠΎΠΌΠ°Π½ΡƒΡŽ с ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ Π²ΡΠΏΠΎΠΌΠΎΠ³Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎΠ³ΠΎ класса Polyline. var myPolyline = new ymaps.Polyline([ // Π£ΠΊΠ°Π·Ρ‹Π²Π°Π΅ΠΌ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Ρ‹ Π²Π΅Ρ€ΡˆΠΈΠ½ Π»ΠΎΠΌΠ°Π½ΠΎΠΉ. [55.80, 37.50], [55.80, 37.40], [55.70, 37.50], [55.70, 37.40] ], { // ΠžΠΏΠΈΡΡ‹Π²Π°Π΅ΠΌ свойства Π³Π΅ΠΎΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π°. // Π‘ΠΎΠ΄Π΅Ρ€ΠΆΠΈΠΌΠΎΠ΅ Π±Π°Π»ΡƒΠ½Π°. balloonContent: "Ломаная линия" }, { // Π—Π°Π΄Π°Π΅ΠΌ ΠΎΠΏΡ†ΠΈΠΈ Π³Π΅ΠΎΠΎΠ±ΡŠΠ΅ΠΊΡ‚Π°. // ΠžΡ‚ΠΊΠ»ΡŽΡ‡Π°Π΅ΠΌ ΠΊΠ½ΠΎΠΏΠΊΡƒ закрытия Π±Π°Π»ΡƒΠ½Π°. balloonCloseButton: false, // Π¦Π²Π΅Ρ‚ Π»ΠΈΠ½ΠΈΠΈ. strokeColor: "#000000", // Π¨ΠΈΡ€ΠΈΠ½Π° Π»ΠΈΠ½ΠΈΠΈ. strokeWidth: 4, // ΠšΠΎΡΡ„Ρ„ΠΈΡ†ΠΈΠ΅Π½Ρ‚ прозрачности. strokeOpacity: 0.5 }); // ДобавляСм линию Π½Π° ΠΊΠ°Ρ€Ρ‚Ρƒ. myMap.geoObjects.add(myPolyline); } 
 <!DOCTYPE html> <html> <head> <title>Ломаная</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script> <script src="polyline.js" type="text/javascript"></script> <style> html, body, #map { width: 100%; height: 100%; padding: 0; margin: 0; } </style> </head> <body> <div id="map"></div> </body> </html>