Automated edits/TTmechanicalupdates/Remove night time conditional speed restriction in urban areas in Poland

From OpenStreetMap Wiki
Jump to navigation Jump to search

Who

TomTom team using TTmechanicalupdates bot account.

The team can be contacted at OSM@tomtom.com

Why

On 2021-06-01 new traffic rules take effect in Poland. According to the updated rules speed is restricted to 50 km/h all the time (up till that moment the limit was 60 km/h during night hours). To align OSM data with new rules we're planning to remove certain conditional speed restrictions from the roads in Poland.

Algorithm

We select all ways and relations with maxspeed tag in Poland with additional tag where:

  • key starts with 'maxspeed' and ends with 'conditional'
  • value contains '60 @ (23:00-05:00)' or '50 @ (05:00-23:00)'. Several variants are taken into account.

The exact overpass query is:

[out:xml][timeout:25000];
area["name"="Polska"]->.searchArea;
(
  wr(area.searchArea)[~"^maxspeed.*conditional$"~"60.*@.*(23:00-0?5:00)"];
  wr(area.searchArea)[~"^maxspeed.*conditional$"~"50.*@.*(0?5:00-23:00)"];
) -> .contitionals;
wr.contitionals[~"^maxspeed(:forward|:backward)?$"~"."];
out body;
>;
out skel qt;

Once candidates for update are selected we process them one by one. Tags are removed in three cases:

  • Element has maxspeed=50 and tag value contains only '60 @ (23:00-05:00)' or '50 @ (05:00-23:00)' or combination of the two and tag key is one of:
maxspeed:conditional
maxspeed:backward:conditional
maxspeed:bus:backward:conditional
maxspeed:bus:conditional
maxspeed:bus:forward:conditional
maxspeed:forward:conditional
maxspeed:hgv:backward:conditional
maxspeed:hgv:conditional
maxspeed:hgv:forward:conditional
maxspeed:trailer:backward:conditional
maxspeed:trailer:conditional
maxspeed:trailer:forward:conditional
  • Element has maxspeed:forward=50 and tag value contains only '60 @ (23:00-05:00)' or '50 @ (05:00-23:00)' or combination of the two and tag key is one of:
maxspeed:bus:forward:conditional
maxspeed:forward:conditional
maxspeed:hgv:forward:conditional
maxspeed:trailer:forward:conditional
  • Element has maxspeed:backward=50 and tag value contains only '60 @ (23:00-05:00)' or '50 @ (05:00-23:00)' or combination of the two and tag key is one of:
maxspeed:bus:backward:conditional
maxspeed:backward:conditional
maxspeed:hgv:backward:conditional
maxspeed:trailer:backward:conditional

Algorithm adjustment

After first execution one more action was added to the algorithm. If one of the conditional tags contains only combination of '60 @ (23:00-05:00)' and '50 @ (05:00-23:00)' values and the simple counterpart tag for this conditional is not present then the conditional is replaced with simple tag with value 50. For example maxspeed:bus:conditional=50 @ (05:00-23:00);60 @ (23:00-05:00) will be replaced with maxspeed:bus=50

The full code can be found at github

Test run

Before running on the whole Poland we will run the same automated updates on a smaller area. For this we've selected Pabianice County area (powiat pabianicki). At the moment of writing (2021-06-21 14:00 CEST) there are 32 objects that would be considered by this automated update.

Test run resulted in one change set: 107142426 (achavi, OSMLab)

Discussion

https://forum.openstreetmap.org/viewtopic.php?id=73116

Opt out

To opt out of this automated update please write an e-mail (in English or in Polish) to TTmechanicalupdates@groups.tomtom.com describing which area and why should be excluded from the update scope.

When

First run: Monday, 5. July 2021

Outcome

First version was run on 5. and 6. July 2021. It edited 81533 ways and 73 relations. 3163 ways and 8 relations are still left with probably outdated conditional speed limits set.

Version after algorithm adjustment was run on 6. July 2021. After this run 540 ways are still left. The remaining cases need manual check. Following MapRoulette challenge was created to cover them: https://maproulette.org/browse/challenges/19343