Automated Edits/cdavila

From OpenStreetMap Wiki
Jump to: navigation, search

Correction of "ele" tag values in survey points imported from Spanish National Geographic Institute (IGN)

History: in 2012 a large dataset was imported from Spanish National Geographic Institute containing 9.690 survey points which form the Conventional National Geodetic Network. Among other data, those nodes contained elevation information for each survey point.

The problem: it has been noticed that elevation values contain several errors:

  1. Decimal separator: comma is used as decimal separator instead of point. Comma is the conventional decimal separator in Spain and it was not changed before importing data from the Spanish IGN. But convention in OSM is to use point as decimal separator, so it should be changed, otherwise values cannot be correctly used by different softwares.
  2. Incorrect use of units: all elevation numerical values of imported nodes are followed by " m.", eg. "2399,15 m.". As other magnitudes in OSM, elevation has a default unit (meters), so it is preferred not to give unit for elevation values if they are already in meters. Anyway, even if unit is used, it should not be followed by a dot nor separated by a space.
  3. Two values are given: for a short number of points values have two numbers separated by semicolon, first of them integer and second decimal. eg. 1250;1250,32. As the number of such errors was very low (7), it has been manually fixed using JOSM.

Edition: the following process has been done to correct all errors described in points 1 and 2 above.

  1. Extract Spain from an up to date planet file.
  2. Filter Spain extract to get all objects meeting all of this criteria:
    • man_made=survey_point
    • ign:latitud=* It ensures the object comes from Spanish National Geographic Institute import, as this tag is not present in nodes added by normal users.
    • ele=*m.
    It's been done with the following osmfilter command:
    osmfilter spain.o5m --keep="man_made=survey_point and ign:latitud=* and ele=*m." >survey_points_to_correct.osm
  3. Remove " m." at the end of each ele tag value.It's been done with unix sed tool as follows:
    sed -i.bak "/'ele'/s/ m./""/" survey_points_to_correct.osm
    .bak command was given to get a backup of unchanged set of nodes in case it is later needed.
  4. Replace comma by point as decimal separator in ele tag. It's been done with unix sed tool as follows:
    sed -i "/'ele'/s/,/./" survey_points_to_correct.osm
  5. Add action='modify' to all nodes. It's been done with unix sed tool as follows:
    sed -i "/timestamp/s/timestamp/ action='modify' timestamp/" survey_points_to_correct.osm
  6. Add a note to inform node has been mechanically edited.It's been done with unix sed tool as follows:
    sed -i "/note/s/move it.' \/>/move it.' \/><tag k='note_1' v='ele tag of this node has been automatically edited by user cdavila, to correct errors: comma as decimal separator has been changed by point and \" m.\" has been removed as unit.' \/>/" survey_points_to_correct.osm
    Tag note_1 is used because all nodes already have a note tag.
  7. Load survey_points_to_correct.osm file in JOSM
  8. Upload data limiting changesets to 50 objects. As there were 8,546 nodes that needed to be fixed, it gave 172 changesets. Each changeset was committed with the following tags: