Mechanical Edits/Mateusz Konieczny - bot account/retag sidewalk=none 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 sidewalk=none to sidewalk=no 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

retag sidewalk=none to sidewalk=no in Poland

Why

Having multiple different but equivalent values is confusing and it should be avoided.

It causes no problem to people using presets but such tag fragmentation discourages mapping by directly editing tags what is unwanted.

sidewalk=none is unwanted duplicate sidewalk=no and there is a clear support to consider it completely deprecated.

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

Some additional validation will be performed as part of making this edit (building=house sidewalk=none would be fixed, not retagged, similarly highway=footway sidewalk=none)

Discussion

Discussed by Polish OSM community at https://forum.openstreetmap.org/viewtopic.php?id=73885

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 wikimedia_connection.wikimedia_connection as wikimedia_connection
import wikibrain.wikimedia_link_issue_reporter
import osm_handling_config.global_config as osm_handling_config

def edit_element(tags):
    if tags.get('sidewalk') != "none":
        return tags
    if tags.get('highway') not in ["motorway", "motorway_link", "trunk",
    "trunk_link", "primary", "primary_link",
    "secondary", "secondary_link", "tertiary", "tertiary_link",
    "unclassified", "residential", "living_street", "pedestrian",
    "service"]:
        print(tags)
        print("expected highway value missing")
        return tags
    tags["sidewalk"] = "no"
    return tags

def main():
    wikimedia_connection.set_cache_location(osm_handling_config.get_wikimedia_connection_cache_location())
    run_simple_retagging_task(
        max_count_of_elements_in_one_changeset=500,
        objects_to_consider_query="""
[out:xml][timeout:25000];
area[name="Polska"]->.a;
(
  way["sidewalk"="none"](area.a);
);
out body;
>;
out skel qt;
""",
        objects_to_consider_query_storage_file='/media/mateusz/OSM_cache/osm_bot_cache/tags_for_retagging.osm',
        is_in_manual_mode=False,
        changeset_comment='migracja sidewalk=none do sidewalk=no',
        discussion_url='https://forum.openstreetmap.org/viewtopic.php?id=73885',
        osm_wiki_documentation_page='https://wiki.openstreetmap.org/wiki/Mechanical_Edits/Mateusz_Konieczny_-_bot_account/retag_sidewalk%3Dnone_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.