Mechanical Edits/Mateusz Konieczny - bot account/moving 'name:botanical'='Platanus × hispanica' to species='Platanus × hispanica' for natural=tree 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.

Who

I, Mateusz Konieczny using my bot account

contact

message via OSM I will respond also to PMs to the bot account. In both cases I will be notified about incoming PMs via email and notifications in OSM editors.

What

Replacing name:botanical=Platanus × hispanica by species=Platanus × hispanica for natural=tree in Poland. Objects with different species=* already present will be not modified.

Why

JOSM encourages to make this name, name:botanical=* is considered as deprecated for good reasons, making this change manually is not useful way to use available human time.

Numbers

Small groups of trees in Poland.

How

An example:
state before a mechanical edit:


state after a mechanical edit:


Changeset would be described and tagged with tags that mark it as automatic, provide link to discussion approving edit, link repository with source code etc. It would include at least


Changeset split into small areas to avoid continent-sized bounding boxes. As this tag is on trees it is not expected that any object will force bounding box to be extremely large.

Edits generated by an osmapi based program using https://github.com/matkoniecz/osm_bot_abstraction_layer .

Discussion

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

Repetition

Redoing this edit in the future would be treated as a new mechanical edit with a new approval process.

Code

Code is GNU GPLv3 licensed.

from osm_bot_abstraction_layer.generic_bot_retagging import run_simple_retagging_task

def is_element_editable(element):
    if element.get_tag_value('natural') != "tree":
        return False
    if element.get_tag_value('name:botanical') != "Platanus × hispanica":
        return False
    if element.get_tag_value('species') == None:
        return True
    return element.get_tag_value('species') == element.get_tag_value('name:botanical')

def edit_element(tags):
    tags['species'] = tags['name:botanical']
    tags.pop('name:botanical', None)
    return tags
    # 
    #tags.get('wikipedia') != None
    #tags['wikipedia'] = expected_wikipedia
    #tags.pop('L_KOND_POD', None)

def main():
    run_simple_retagging_task(
        max_count_of_elements_in_one_changeset = 500,
        objects_to_consider_query = """
[out:xml][timeout:25];
area[name='Polska']->.searchArea;
(
  node["name:botanical"="Platanus × hispanica"](area.searchArea);
  way["name:botanical"="Platanus × hispanica"](area.searchArea);
  relation["name:botanical"="Platanus × hispanica"](area.searchArea);
);
out body;
>;
out skel qt;
""",
        objects_to_consider_query_storage_file = '/media/mateusz/5bfa9dfc-ed86-4d19-ac36-78df1060707c/OSM-cache/overpass/tags_for_retagging.osm',
        is_in_manual_mode = False,
        changeset_comment = 'migrating name:botanical tag to species tag',
        discussion_url = 'https://forum.openstreetmap.org/viewtopic.php?id=64421',
        osm_wiki_documentation_page = 'https://wiki.openstreetmap.org/wiki/Mechanical_Edits/Mateusz_Konieczny_-_bot_account/moving_%27name:botanical%27%3D%27Platanus_%C3%97_hispanica%27_to_species%3D%27Platanus_%C3%97_hispanica%27_for_natural%3Dtree_in_Poland',
        is_element_editable_checker_function = is_element_editable,
        edit_element_function = edit_element,
        )

main()

Opt-out

Please comment in the discussion thread (see #Discussion).