I live in Moscow and travel mostly by car. Like many other drivers, I actively use Yandex cards. Over the past few years, Yandex has become almost the only quantitative indicator of the traffic situation in major cities of our country. Many mass media officially refer to the testimony of the same name “analytical service” in their reports and articles. The city authorities report on their successes, demonstrating a positive trend in road congestion, again according to Yandex. In a word, it works and brings real benefits.
It became interesting for me to see the road loading dynamics not with “Yandex’s eyes” , but with my own eyes, as I’m used to seeing on the Yandex website every day. Traffic information is updated every 4 minutes , so the resulting video is a variation on the topic of time-lapse shooting. ')
My first search on YouTube was apparently a bit messy and did not find anything like it. I set to work. Already in the process, I went back to the search again and found the next video , and then another. Of course, I was somewhat upset that the palm had already been torn away, but did not throw it, especially since the laptop in the closet had already recorded a couple of gigabytes of screenshots.
I will briefly describe the tools I used:
Yandex provides a fairly rich toolkit for the user. For example, the Static-API allows you to literally do what I needed: upon request, to receive a screenshot of the interesting part of the map 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. The Yandex Maps API is significantly richer and more democratic than the Static-API.
I have never had to do web programming before. I had to learn a little JavaScript (it implements the f-II API) and PHP. Pretty quickly, it was possible to write an html file with JavaScript inserts, which displayed a piece of a map of the desired size that interests me with a layer of traffic jams (thanks to a 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 pictures of any page and can be run from the console. I didn’t quite understand whether it implements the f-ii browser itself or clings to IE. In terms of CSS support, the program behaves like a browser from Microsoft (for example, by default it does not support border-radius and box-shadow). Nevertheless, she solves the problem.
It remains to write a simple bat-file for periodic startup and file naming. The chain turned out like this: a bat-file periodically launches url2bmp with the necessary parameters. He turns to a denwer server where my html with js inserts is located, which in turn displays a map obtained using the Yandex f-th API.
As a result, for 6 days, ~ 7 gigabytes of bmp-files were accumulated. Information about traffic jams 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) discard duplicate images (the names of the matching files were different). 2) cut off the scroll bar on images (the option “Remove right scroll bar” url2bmp for some reason pumped up). 3) edit the video, select and apply the appropriate music.
The first task was solved by the free utility CloneSpy . IrfanView successfully coped with the second one. A third easily closed VirtualDub .
As a result, it turned out to shoot 6 days from Monday (04/15/2k13) to Saturday (04/20/2k13). Truth happened a couple of passes. One is through the provider’s fault, the other is mine’s (ran out of money in the account). Traffic jams on the resulting video do not behave very smoothly. It is hardly to blame for the 4-minute interval m / y reports. However, the general trends and bottlenecks are defined rather clearly.