[mkgmap-dev] [PATCH] Print error message if no reading bounding box
From Johann Gail johann.gail at gmx.de on Tue Feb 17 21:53:52 GMT 2009
Ok, I finally found the reason for my bounding box / clipping problems. It has somethign to do with the regional settings. See the excerpt from a splitter generated osm file: <?xml version='1.0' encoding='UTF-8'?> <osm version='0.5' generator='splitter'> <bounds minlat='47,241211' minlon='8,964844' maxlat='49,042969' maxlon='11,425781'/> <node id='127289' lat='48.2177779' lon='11.3281777'> <tag k='highway' v='mini_roundabout'/> </node> <node id='127290' lat='48.2164303' lon='11.3245295'/> <node id='127291' lat='48.2161293' lon='11.323863'/> <node id='127292' lat='48.2154694' lon='11.3228149'/> Watch the decimal separator! In the bounding it is a comma, in the rest it os a dot. This is the reason for the bounding box not working. To detect this error print a error message in mkgmap: Index: src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java =================================================================== --- src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java (Revision 901) +++ src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java (Arbeitskopie) @@ -324,6 +324,7 @@ Double.parseDouble(xmlattr.getValue("maxlon"))); } catch (NumberFormatException e) { // just ignore it + e.printStackTrace(); } } @@ -335,6 +336,7 @@ log.debug("Map bbox: " + bbox); } catch (NumberFormatException e) { // just ignore it + e.printStackTrace(); } } To resolve this error you have to modify splitter SubArea.java. I don't think this is the optimal solution, but it should work. (Not tested yet) I don't know if it is possible to set the NumberFormat global for the application. Index: src/uk/me/parabola/splitter/SubArea.java =================================================================== --- src/uk/me/parabola/splitter/SubArea.java (Revision 21) +++ src/uk/me/parabola/splitter/SubArea.java (Arbeitskopie) @@ -25,6 +25,7 @@ import java.util.Formatter; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.zip.GZIPOutputStream; @@ -105,7 +106,7 @@ writer.append("<?xml version='1.0' encoding='UTF-8'?>\n"); writer.append("<osm version='0.5' generator='splitter'>\n"); - Formatter fmt = new Formatter(writer); + Formatter fmt = new Formatter(writer, Locale.US); fmt.format("<bounds minlat='%f' minlon='%f' maxlat='%f' maxlon='%f'/>\n", Utils.toDegrees(bounds.getMinLat()), Utils.toDegrees(bounds.getMinLong()),
- Previous message: [mkgmap-dev] Commit: r904: Add options to set overview description and product version.
- Next message: [mkgmap-dev] [PATCH] NumberFormat in Splitter
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list