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:
- 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.
- 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.
- 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.
- Extract Spain from an up to date planet file.
- Filter Spain extract to get all objects meeting all of this criteria:
- 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.
- 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
- 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.
- 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
- 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
- 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.
- Load survey_points_to_correct.osm file in JOSM
- 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:
- comment: mechanical edit of "ele" tag values in survey points imported from Spanish National Geographic Institute to correct the following errors: comma as decimal separator has been changed by point and " m." has been removed as unit.