Answer the question
In order to leave comments, you need to log in
How to make a button on the site to build a route with a transition to Yandex maps?
The following code is currently being used:
<a href="https://yandex.ru/maps/?rtext=55.659173,37.762848&rtt=mt">Построить маршрут в Яндекс.Карты</a>
Answer the question
In order to leave comments, you need to log in
Everything is much simpler
. Just put a tilde in front of the coordinates)
<a href="https://yandex.ru/maps/?rtext=~55.659173,37.762848">Построить маршрут в Яндекс.Карты</a>
Alternatively, if there is an API to use.
https://tech.yandex.ru/maps/jsbox/2.1/geolocated_m...
Paste this code and Update.
ymaps.ready(function () {
var myMap = new ymaps.Map('map', {
center: [55.753994, 37.622093],
zoom: 9,
// Добавим кнопку для построения маршрутов на карту.
controls: ['routeButtonControl']
});
var control = myMap.controls.get('routeButtonControl');
// Зададим координаты пункта отправления с помощью геолокации.
control.routePanel.geolocate('from');
control.routePanel.state.set({
type: "pedestrian",
to: '55.659172, 37.762848'
});
// Откроем панель для построения маршрутов.
control.state.set('expanded', true);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question