[mkgmap-dev] elevation/depth point in *.osm & *.mp
From David david.tlp at orange.fr on Wed Feb 25 12:26:46 GMT 2009
As I was trying to compile an old map with mkgmap, I discovered that elevation spots (0x6300) were wrong. They should be converted in the same manner as contour lines. Now the question is : which tags define depth and elevation spots in OSM format (an elevation spot is not always a named peak) ? Here is the patch for both depth and elevation spots : Index: PolishMapDataSource.java =================================================================== --- PolishMapDataSource.java (revision 929) +++ PolishMapDataSource.java (working copy) @@ -261,6 +261,12 @@ Coord co = makeCoord(value); setResolution(point, name); point.setLocation(co); + /* if it is depth spot (0x6200) or elevation spot (0x6300), then fix units if required */ + if ((point.getType() == 0x6200) || + (point.getType() == 0x6300)){ + fixPointElevation(); + } + } } @@ -282,7 +288,7 @@ if ((polyline.getType() == 0x20) || (polyline.getType() == 0x21) || (polyline.getType() == 0x22)) { - fixElevation(); + fixPolylineElevation(); } setResolution(polyline, name); @@ -318,7 +324,7 @@ * The elevation needs to be in feet. So if it is given in meters then * convert it. */ - private void fixElevation() { + private void fixPolylineElevation() { if (elevUnits == 'm') { String h = polyline.getName(); try { @@ -333,6 +339,21 @@ } } + private void fixPointElevation() { + if (elevUnits == 'm') { + String h = point.getName(); + try { + // Convert to feet. + int n = Integer.parseInt(h); + n *= METERS_TO_FEET; + point.setName(String.valueOf(n)); + + } catch (NumberFormatException e) { + // ok it wasn't a number, leave it alone + } + } + } + /** * Called for each command in a POLYGON section. There will be a Data * line consisting of a number of co-ordinates that must be separated out
- Previous message: [mkgmap-dev] YATTLE (Yet another tile-too-large exception)
- Next message: [mkgmap-dev] Duplicated POI's in overlapping areas.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list