Automated edits/Kai Johnson - Alabama Place Tags

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 restore wikidata=*, wikipedia=*, population=*, population:date=*, source:population=*, and name:*=* tags that were unintentionally removed during recent editing.

Who

This automated edit will be performed by Kai Johnson. I can be reached via messages to my OSM Profile or to my OSM Community Forum account.

Why

The administrative boundaries in Alabama were recently updated from 2006 TIGER data to 2023 TIGER data. In the process, each boundary was assigned a place=* node with the label role if it did not have one. During the updates the wikidata=*, wikipedia=*, population=*, population:date=*, source:population=*, and name:*=* tags that were unintentionally removed from the place=* nodes.

These tags are useful to have on the place=* nodes so that data consumers can access this information without having to parse the boundary relations.

What

This automated edit proposes to restore the wikidata=*, wikipedia=*, population=*, population:date=*, source:population=*, and name:*=* tags where they are missing from the place nodes in Alabama. These tags will be copied from the parent boundary relation to the place node that has the label role in the parent relation -- but only if the name=* tags match between the boundary relation and the place node. No existing tags will be replaced -- tags will only be copied from the boundary relation to the place node if they do not exist on the place node.

How

All the administrative boundary relations and related place nodes in Alabama will be downloaded using the following Overpass queries:

Overpass Query for Boundary Relations

{{geocodeArea:Alabama}}->.alabama;

relation["boundary"~"(administrative|census)"](area.alabama) -> .boundaries;  

.boundaries out meta;

Overpass Query for Place Nodes

{{geocodeArea:Alabama}}->.alabama;

node["place"~"(city|town|village)"](area.alabama) -> .places;

.places out meta;

Post-Processing

The two XML files from the Overpass queries will be processed using a script that performs the following steps:

  1. Match place nodes to boundary relations by comparing the node's OSM element ID to the element ID of the label member of the relation.
  2. Compare the name=* tags on the node and relation and stop processing if they do not match.
  3. If any of the wikidata=*, wikipedia=*, population=*, population:date=*, source:population=*, and name:*=* tags are present on the relation and not present on the node, copy these tags to the node.
  4. If any tags have been copied to the node, add the node to an OsmChange XML file to make the tag changes.

The OsmChange XML file will be opened in JOSM and uploaded to OSM in a single changeset.

Discussion

This automated edit was originally discussed in the OSM US Slack and has been mentioned in the local-alabama channel there.

This proposal has been posted for discussion on the OSM Community Forum.

Completion

This automated edit was completed in Changeset 151779412.