A
A
AlexFo902019-05-01 16:30:05
JavaScript
AlexFo90, 2019-05-01 16:30:05

How to draw a straight line from Placemark to Placemark (yandex map)?

Hello! Can someone tell me how to draw a straight line from one point to another in the yandex map

ymaps.ready(init);

function init() {
  var myMap = new ymaps.Map("map", {
    center: [55.72, 37.44],
    zoom: 10
  });
  var polyline = new ymaps.Polyline([
    [55.80, 37.50],
    [55.70, 37.40]
  ], {
      balloonContent: "Ломаная линия"
    }, {
      strokeColor: "#000000",
      strokeWidth: 4,
      strokeOpacity: 0.5
    });

  var polyline2 = new ymaps.Polyline([
    [55.84, 37.52],
    [53.90, 37.41]
  ], {
      balloonContent: 'Другая ломанная линия',
    }, {
      strokeColor: "#000000",
      strokeWidth: 4,
      strokeOpacity: 0.5
    })

  myMap.geoObjects
    .add(polyline)
    .add(polyline2)
}

Can I somehow implement it so that if I have 2 points and I start to pull one to the side - the line is drawn behind them and the points are connected?
Thanks to those who respond) At least push the solution

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question