Yandex.Maps-Time.Lapse


Better to watch in maximum quality.


I live in Moscow and travel mostly by car.
Like many other drivers, I actively use Yandex maps.
Over the past few years, Yandex has become almost the only quantitative indicator of the traffic situation in large cities of our country. Many media outlets officially refer to the testimony of the eponymous “analytical service” in their reports and articles. City officials report on their successes, demonstrating the positive dynamics of traffic congestion, again according to Yandex. In a word, it works and brings real benefits.

It became interesting for me to see the dynamics of road loading not with “Yandex eyes”, but with my own eyes, since I'm used to seeing on the Yandex website every day. Information about traffic jams is updated every 4 minutes , so the resulting video is a variation on the theme of time-lapse shooting.

My first YouTube search was apparently a bit messy and didn't find anything like it. I set to work. Already in the process, once again I returned to the search and found the following video clip , and then another one . Of course, I was a little upset that the championship palm had already been ripped off, but I didn’t quit, especially since the laptop in the closet already recorded a couple of gigabytes of screenshots.

Briefly describe the tools that I used:

Yandex provides a fairly rich toolkit for the user.
for instanceThe Static-API allows you to do literally what I needed: upon request, get a picture-screenshot of the map section of interest along with a layer of traffic jams. Unfortunately, there is a limit on the maximum image size. Only 650x450 pixels. In my case, this was clearly not enough.
Yandex Maps API compared to Static-API is much richer and more democratic.

I've never had to do web programming before. I had to learn a little JavaScript (it implements API functions) and PHP. Quite quickly I managed to write an html file with JavaScript inserts that displayed the piece of the map of interest to me of the right size with a layer of traffic jams (thanks to the friend and members of the ya.ru club for help).

Next, you had to learn how to take a screenshot and save the file to disk. This was helped by the free utility url2bmp , which allows you to take snapshots of any page and can be launched from the console. I did not quite understand whether it independently implements browser features or clings to IE. In terms of CSS support, the program behaves like a browser from Microsoft (for example, it does not support border-radius and box-shadow by default). Nevertheless, she solves the problem.

It remains to write a simple bat-file for periodic launch and file naming. The chain is as follows: the bat-file periodically launches url2bmp with the necessary parameters. He turns to the denwer server , where my html with js inserts lies, which in turn displays a map obtained using the Yandex Yandex API.

As a result, ~ 7 gigabytes of bmp files accumulated over 6 days. Traffic information on the Yandex website is updated every 4 minutes. Just in case, I took a screenshot with a period of 2 minutes. Therefore, it remains to solve only 3 problems at the finish line:
1) throw out duplicate images (the names of the matching files were different at the same time).
2) crop the scroll bar on images (the “Remove right scroll bar” option url2bmp for some reason let us down).
3) mount the video, select and impose the appropriate music.

The first task was solved by the free utility CloneSpy .
The second was successfully handled by IrfanView .
And the third one was easily closed by VirtualDub .

As a result, it turned out to shoot 6 days from Monday (04.15.2k13) to Saturday (04.20.2k13).
True, a couple of passes happened. One is the fault of the provider, the second is mine (the money in the account has run out).


Traffic jams in the resulting video do not behave very smoothly. It is unlikely that the 4-minute interval m / y reports. However, general trends and bottlenecks are fairly explicit.

Also popular now: