Mechanical Edits/Mateusz Konieczny - bot account/removing useless surface tags
Page content created as advised on Automated_Edits_code_of_conduct#Document and discuss your plans.
This edit will remove useless surface=* tags
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
remove
Why
Why it is useful? It helps newbies to avoid becoming confused. It protects against such values becoming established. Without drudgery that would be required from the manual cleanup. It also makes easier to add missing surface= values
Why automatic edit? I a have massive queue (in thousands and tens of thousands) of automatically detectable issues which are not reported by mainstream validators, require fixes and fix requires review or complete manual cleanup.
There is no point in manual drudgery here, with values completely useless.
This values here do NOT require manual overwiev. If this cases will turn out to be an useful signal of invalid editing than I will remain reviewing nearby areas where bot edited.
Yes, bot edit WILL cause objects to be edited. Nevertheless, as result map data quality will improve.
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
Discussed at talk mailing list at https://lists.openstreetmap.org/pipermail/talk/2022-July/087676.html
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
import hashlib from osm_bot_abstraction_layer.generic_bot_retagging import run_simple_retagging_task def invalid_surfaces(): return ["unclassified", "unknown", "undefined"] def edit_element(tags): if tags.get('surface') in invalid_surfaces(): tags.pop('surface', None) return tags return tags def main(): query = "" query += """ [out:xml][timeout:25000]; ( """ for value in invalid_surfaces(): query += " nwr[surface='" + value + "'];" query += """ ); 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='removing surface values not adding any useful data', discussion_url="https://lists.openstreetmap.org/pipermail/talk/2022-July/087676.html", osm_wiki_documentation_page='https://wiki.openstreetmap.org/wiki/Mechanical_Edits/Mateusz_Konieczny_-_bot_account/removing_useless_surface_tags', 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.