logo separator

Converting units

24
Nov

There has always been a way to convert a tag value from meters to feet, this was originally for contour heights which need to be in feet, but the default for OSM is for them to be in meters.

With the release of version r3353 these conversions are much more useful and can be applied to speeds as well as lengths. They also take into account any unit that is already specified.

So for example if you specify a conversion of meters to feet, then "100" will be converted to "328", "100m" will be converted to "328" but "100ft" will be left as "100". Furthermore "100km" would result in "328000". If any of the units are not recognised then the value remains completely unchanged.

Input Result
100 328
100m 328
100ft 100
100km 328000
100xyz 100xyz

Here are some examples.

natural=hill & height=* {
	set height='${height|conv:"m=>ft"}';
    }

highway=* & maxspeed=* {
	set limit='${maxspeed|conv:"kmh=>mph"}';
    }

The possible units are:

  • Length: m, km, ft (feet), mi (miles).
  • Speed: mph; km/h (or kmh, kmph), knots
Posted by steve on 24 Nov 2014

Latest commits

  • mkgmap-r4808 implement new option --gmapi-minimal (gmapi-minimal-v5.patch).
    12 oct 2021
  • mkgmap-r4807 fix possible NPE when --keep-going is used in combination with an input file that doesn't exist.
    14 sep 2021
  • splitter-r642 Crash with message "Invalid polygon ring in polygon-file, possibly self-intersecting" if a single ring in a *.poly file is not ....
    10 aug 2021
  • mkgmap-r4806 missing brackets: fix NullPointerException when option --pois-to-areas-placement is used with invalid args like.
    10 aug 2021
  • mkgmap-r4805 split route center if last offset in TableC (route restrictions) size is >= 0x8000.
    07 aug 2021
See more...