Mechanical Edits/Mateusz Konieczny - bot account/retag old style parking conditions in Poland

From OpenStreetMap Wiki
Jump to navigation Jump to search

Page content created as advised on Automated_Edits_code_of_conduct#Document_and_discuss_your_plans.

This edit will retag old style parking conditions in Poland.

Who

I, Mateusz Konieczny using my bot account

contact

message via OSM I will respond also to PMs to the bot account, though messaging my main account is preferable as I will get notifications in OSM editors.

English and Polish languages are preferable, for other I need to use an automatic translator.

What

Why

Parking lane tagging schemes are complicated already, there is no benefit from multiple tagging schemes being present at once.

Yes, editing objects will edit them, change date of last edit and add entry to history. Negative effects of that are minimal and not important.

On the other hand validation, spot checks and review of bot edits will result in fixing some other issues that would not be spotter otherwise and reduces changes of various mistakes if it would be done manually.

Numbers

Large enough to make it useful to automate it.

How

state after a mechanical edit:

Changeset would be described and tagged with tags that mark it as automatic, provide link to discussion approving edit, include link promoting https://matkoniecz.github.io/OSM-wikipedia-tag-validator-reports/ etc

Discussion

Presented to Polish OSM community at https://forum.openstreetmap.org/viewtopic.php?pid=862685#p862685 and https://community.openstreetmap.org/t/parkingleft-parkingright-parkingboth-edycja-bota/1980

Support initially checked and confirmed at Polish Discord channel

Repetition

This is reoccurring edit and may be made as soon as new matching elements appear. At this moment triggering new edit requires human intervention so exact schedule is not predictable and bot may stop running at any moment.

This can change in a future. If bot is abandoned and does not run, feel free to ping me. If I am unable to run it any more feel free to use my code. Note that it may require going through bot approval process again and that code is on specific license.

https://codeberg.org/matkoniecz/OpenStreetMap_cleanup_scripts/src/branch/master/recurrent_bot_edits may have more up to date code version that what is listed on this page

Source code

GPL 3.0 licensed

from osm_bot_abstraction_layer.generic_bot_retagging import run_simple_retagging_task
import hashlib

def edit_element(tags):
    for side in "both", "left", "right":
        tag = 'parking:lane:'+side
        if tags.get(tag) in ("no_parking", "no_standing", "no_stopping"):
            tags['parking:condition:'+side] = tags.pop(tag, None)
    return tags

def main():
    print("bot edit proposed: https://forum.openstreetmap.org/viewtopic.php?pid=862685#p862685 ")
    print("confusion: https://wiki.openstreetmap.org/wiki/Talk:Key:parking:condition#parking%3Alane%3Aright%3Dno_vs_parking%3Acondition%3Aright%3Dno_stopping ")
    query = """
[out:xml][timeout:25000];
area[name="Polska"]->.a;
(
  way["parking:lane:left"~no](area.a);
  way["parking:lane:right"~no](area.a);
  way["parking:lane:both"~no](area.a);
);
out body;
>;
out skel qt;
"""
    hashed = hashlib.sha256(query.encode('utf-8')).hexdigest()
    run_simple_retagging_task(
        max_count_of_elements_in_one_changeset=500,
        objects_to_consider_query=query,
        objects_to_consider_query_storage_file='/media/mateusz/OSM_cache/osm_bot_cache/tags_for_retagging_' + hashed + '.osm',
        is_in_manual_mode=False,
        changeset_comment='migrate old parking lane tagging | migracja starego tagowania parkowania',
        discussion_url="https://forum.openstreetmap.org/viewtopic.php?pid=862685#p862685 https://community.openstreetmap.org/t/parkingleft-parkingright-parkingboth-edycja-bota/1980",
        osm_wiki_documentation_page="https://wiki.openstreetmap.org/wiki/Mechanical_Edits/Mateusz_Konieczny_-_bot_account/retag_old_style_parking_conditions_in_Poland",
        edit_element_function=edit_element,
    )

main()

Opt-out

Please write at bot approval thread. Note that in case of opt-out exactly the same edit will be made manually for objects where bot opt-out was used.