📜 ⬆️ ⬇️

Road Network OpenStreetMap

One of the main parameters of the map is the information content. Roughly speaking, this is how much information you can read from a card with your own eyes. At the most detailed scale, everything looks simple: there is a lot of space on the screen and you need to draw everything that is interesting to the user (we have in the data file). Although there remains an important task - to determine what is still interesting to him. On a review scale, everything is more complicated: there is too much data and you need to select those that will increase the information content and visibility of the map. At the same time, the card cannot be overloaded. If you display everything, it will become unreadable. And there are practically no suitable objects for display at a general scale without preliminary processing of types of objects interesting to the user!

In this article I want to touch on one of the important components of the informativeness of the overview scale - the road network.



The bottom line is that you need to display a beautiful road network on the overview scale map. This is done so that the map does not seem empty. On the purchased data this task is successfully solved by styles. When all the data comes from one supplier, they are homogeneous and you can simply describe which roads you need to draw on what scales. But OpenStreetMap is not like that. The map, which is filled by users from all over the world, harbors a lot of differences and regional features in the mapping methods. On a review scale, these differences are seen especially clearly. Because of them, it is not possible to draw a coherent and beautiful network of roads on top of the map.
')
If you cannot rely on the initial data, then you need to come up with your own mechanism for determining the road network connecting the states. About him and will be discussed.

Initial data


The highway tag is used to denote roads in OpenStreetMap. It can take the values ​​of motorway , trunk , primary , secondary , residental , service and others. You can read more about the tag in the project Wiki.

The motorway tag denotes highways. In Moscow, he marked toll routes (Don, M-11, new Leningradka) and some departure routes (Simferopol Highway). However, this tag is not marked MKAD and the majority of departure lines. In Poland, only a couple of tracks have a motorway tag. And one of them is a detour of the city. In Europe and the United States, this tag is more common and forms a coherent road network, but many roads from the US end at the border with Canada. All this makes it impossible to use a single motorway tag.


Roads tagged motorway

The next most important road is the trunk tag. He marked "the most important roads that are not motorway." When taking this tag into account, the Moscow Ring Road and Betonka appear in Moscow, and most of the departure lines are also marked. And in Poland, there were only a few additional detours of cities. The European road network has lost its integrity. There are many detours here labeled highway=trunk . In the US, there are few such roads, and they are almost lost in the developed motorway road network.

As a result, the map does not get a single road network. In different cities, the same tags designate different quality roads. Often the more "weighty" tags denote tiny sections of detours of cities. Since the entire highway is not marked with these tags, the road “hangs” in the air, which looks ugly. And the problem itself is not new. Osmer faced with it for a long time, only things are there.

Calculation method


So, the task is to draw roads on an overview scale. And all the roads can not be drawn, since the map will immediately become unreadable. It turns out that it is necessary to raise only the "main". The dominance of the roads can be defined in different ways. I chose the way in which I assess the importance of the road by how much it participates in building the route from point A to point B. To do this, I build routes and check on which roads these routes have passed.

As a unit of addressing, I chose the OSM-identifier of the path (way) of the section along which the road runs. Strictly speaking, the route can only go through part of the OSM element, but since the geometry is simplified on the overview scales, and the elements themselves are relatively short, I take them all into account.

In order to determine which roads are involved in the construction of routes, I used OSRM. True, for this it had to be slightly modified. The main role is played by a special plug-in for the server, which instead of route points displays a sequence of wayID , along which the route passes. The source code of this plugin can be found in our repository.

First attempt: we connect all capitals with roads


As a first experiment, I took all the capitals on earth (points of cities with the capital=yes tag) and built roads “every with every”. On a panoramic scale, I raised all the roads that were used at least once when laying routes. As a result, I got a single network that covered Europe and even the western part of Russia well. But here again the regional difference in the customs of OSM mapping showed itself. In Russia, the tag capital=yes marks all cities that are the administrative centers of regions, for example, Tula. But in the United States only the city of Washington is tagged with capital . As a result, the resulting road network in the United States is scarce and runs all along the east coast. Siberia remained uncovered.





Also, over time, I noticed that the road network between the capitals is painfully dense. Despite the fairly clear description of the tag in its proposal (proposal), which defines the values ​​of yes / no, the most popular value ... capital=8 !!! capital=yes/no accounts for less than 3.7%! So believe after this OSM documentation. In addition, capital=yes massively used in the Philippines. To separate local capitals, you need to consider the value admin_level . Which also varies greatly around the world. The wiki even has a label on how to read this tag.

Second try


If there are few capitals, and after filtering them even less, then we will add ordinary cities to the construction. But there are many of them, as well as the roads between them, so you need to take only those cities that will allow you to build a road network. For the sample, I used two criteria: the population of the city and proximity to the already selected items. The proximity parameter allows you to filter the cities that are nearby. New roads between them will look bad on a review scale. Taking into account the population (where it is) will allow to draw roads to the most important cities.

On the example of Russia, it turned out that in the European part, we have many cities marked with the capital tag and all other cities were eliminated. But Yakutia is much less populated. In order to draw at least something here, the algorithm raises the settlement of Deputatsky with 2831 inhabitants and the road to it on a survey map. But since there are noticeably more such cities on the map, I only take the roads from them to several nearby cities. This allows you to reduce the number of calls to the router and simplify the requests themselves.



findings


Here's what I got as a result:



After updating the application, the resulting image can be seen on your own phone. The completed steps allowed us to obtain a coherent network of roads on an overview map scale. Due to the fact that the map is actively developing, new roads are marked on it and the current, calculated data are updated quickly become obsolete. In fact, for each data generation, the road network has to be considered from scratch, and this increases the time required to prepare the data. But such processing allows you to increase the visibility of the map and overcome some of the inherent problems of OpenStreetMap.

Source: https://habr.com/ru/post/280970/


All Articles