A
A
Anton2015-11-24 08:20:33
PHP
Anton, 2015-11-24 08:20:33

Traffic jams, how can I make an informer points?

Hello, I know how to make a traffic jam map with a points informer, I have already formed it. I made a big map on a separate page.
On the main page, I made a block where I want to add a small points informer, the one that is a traffic light, how to do this? so that only it is shown, I will make it a link, by clicking on it, we get to the full brock map.
ceacaae8294c4742af6376df4eac683c.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-11-24
@aspetek

https://export.yandex.ru/bar/reginfo.xml?region=XX
Take the region from here https://yandex.ru/yaca/geo.c2n
How to parse XML, I think you will figure it out

D
Dmitry Pyrkin, 2015-11-24
@ps1panda

Yandex api to help

ymaps.ready(init);

function init () {
    var myMap = new ymaps.Map('map', {
            center: [55.751574, 37.573856],
            zoom: 10,
            controls: []
        });

    // Создадим элемент управления "Пробки".
    var trafficControl = new ymaps.control.TrafficControl({ state: {
            // Отображаются пробки "Сейчас".
            providerKey: 'traffic#actual',
            // Начинаем сразу показывать пробки на карте.
            trafficShown: true
        }});
    // Добавим контрол на карту.
    myMap.controls.add(trafficControl);
    // Получим ссылку на провайдер пробок "Сейчас" и включим показ инфоточек.
    trafficControl.getProvider('traffic#actual').state.set('infoLayerShown', true);    
}

<html>
<head>
    <title>Примеры. Элементы управления "Пробки"</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- Если вы используете API локально, то в URL ресурса необходимо указывать протокол в стандартном виде (http://...)-->
    <script src="//api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
    <script src="traffic_control.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>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question