Re: [mkgmap-dev] splitter OutOfMemoryError
Carlos, Using sun java as in machine A fixed the problem for splitter, although mkgmap still needs a slightly higher amount of memory. May it be due to --max-jobs? Sure, if you have more cores available than before, --max-jobs will process that number of maps in parallel so it will take more memory. Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Improvement of error message
Hi Carlos, Building a map of Europe I get the following message: Overflow of the NET1. The tile must be split so that there are fewer road in it Would it be possible to include tile name in the message? Please try attached patch. If good, I will commit it. Mark diff --git a/src/uk/me/parabola/imgfmt/app/net/RoadDef.java b/src/uk/me/parabola/imgfmt/app/net/RoadDef.java index 0b4f12d..9972c08 100644 --- a/src/uk/me/parabola/imgfmt/app/net/RoadDef.java +++ b/src/uk/me/parabola/imgfmt/app/net/RoadDef.java @@ -336,7 +336,7 @@ public class RoadDef implements Comparable { */ void writeRgnOffsets(ImgFileWriter rgn) { if (offsetNet1 = 0x40) - throw new ExitException(Overflow of the NET1. The tile must be split so that there are fewer road in it); + throw new ExitException(Overflow of the NET1. The tile ( + log.threadTag() + ) must be split so that there are fewer roads in it); for (Offset off : rgnOffsets) { rgn.position(off.getPosition()); diff --git a/src/uk/me/parabola/log/Logger.java b/src/uk/me/parabola/log/Logger.java index 7b341d3..eddee6e 100644 --- a/src/uk/me/parabola/log/Logger.java +++ b/src/uk/me/parabola/log/Logger.java @@ -237,4 +237,8 @@ public class Logger { public void threadTag(String tag) { threadTags.set(tag); } + + public String threadTag() { + return threadTags.get(); + } } ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] mkgmap gives java error
Hello Tony, I got my first GPS recently, a Garmin GPSmap 60CSx, and am now trying to create maps for it via mkgmap, but am having problems. I'm running Debian Lenny, with mkgmap-r1600 (current version) and Sun Java 6. My machine is 32-bit AMD with 2GB memory. I managed OK (using an older mkgmap version) to convert and upload a few small city maps (Dublin, Barcelona, etc.) but can't manage (using either mkgmap version) a bigger map, all of Ireland, which I got from Geofabrik (http://download.geofabrik.de/osm/). The .osm file is 318MB in size. When I run mkgmap (with no options) I get an error, which starts as follows: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:3209) at java.lang.String.init(String.java:216) at com.sun.org.apache.xerces.internal.xni.XMLString.toString(XMLString.java:185) at com.sun.org.apache.xerces.internal.util.XMLAttributesImpl.getValue(XMLAttributesImpl.java:537) at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.processAttributes(XIncludeHandler.java:2030) at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.startElement(XIncludeHandler.java:907) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400) I then used splitter (current version) to split the map file, which resulted in a single file being produced, 142MB after unpacking (less than half the size of the original!?), and submitted that to mkgmap, but it bombed out again (though with a different error). Can anybody suggest what I might need to do to get it working? Sounds like you need to specify a suitable value for the splitter's --max-nodes option so that it creates multiple output files rather than just one (i.e. it really does split the map!) I prefer small tiles so I normally use --max-nodes=60 Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v1] - sleep-on-startup
I recently discovered jvisualvm and have been using it to profile mkgmap. One thing I haven't discovered yet is how to profile an application from the start - its trivial to attach to an already running java app using the gui but if it's already running, you could miss some useful info. So, the attached patch is a little kludge that lets you start mkgmap but then it immediately pauses for a little while (long enough to attach jvisualvm to it and turn on the profiling, etc.) before it gets down to work. To use this, just add -Dsleep-on-startup=30 or similar to your Java args. Can anyone think of a better way of achieving the same goal? Mark diff --git a/src/uk/me/parabola/mkgmap/main/Main.java b/src/uk/me/parabola/mkgmap/main/Main.java index 8e9a389..a304c46 100644 --- a/src/uk/me/parabola/mkgmap/main/Main.java +++ b/src/uk/me/parabola/mkgmap/main/Main.java @@ -88,6 +88,18 @@ public class Main implements ArgumentProcessor { */ public static void main(String[] args) { + try { + int delayPeriod = Integer.decode(System.getProperty(sleep-on-startup, 0)); + if(delayPeriod 0) { +System.err.println(Sleeping for + delayPeriod + seconds...); +Thread.sleep(delayPeriod * 1000); +System.err.println(Wake up, time for work!); + } + } + catch(Exception e) { + // relax + } + // Temporary test for version 1.6. During a transition period we are // compiling with target 1.5 so that it will run with 1.5 long enough // to give an error message. ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Java issue with mkgmap
Hi Nakor, I don't know what is causing the SEGV but have you tried using another runtime? Perhaps, it's a problem in OpenJDK. # Java VM: OpenJDK 64-Bit Server VM (14.0-b16 mixed mode linux-amd64 ) Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] Why are all the un-named peaks called '6140565'?
Stylists, Just noticed that in the UK map, points tagged natural=peak that don't have a name are showing a name of '6140565'. I guess it's something to do with this rule from the points file: natural=peak {name '${name|def:}${ele|height:m=ft|def:}' } [0x6616 resolution 18] The style language is completely beyond me, what's it doing? Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] mkgmap gets stuck on Kosovo - is related to -c template.args
Felix, Ups, sorry. I don't understand why it ran through using the default style, but it is hanging on the templates.args file which seems to be the real culprit. If I run mkgmap with *.osm.gz for map input, it runs through fine. If however I use -c template.args then it gets stuck infinitely. I have attached the problem causing template.args to this mail. Maybe something is wrong with it??? (it is supposed to compile tile 6322.osm.gz). It only happens on a very few countries. (I run splitter.jar with following commandline: java -Xmx4050m -Xmx4500M splitter.jar --mapid=6322 --max-nodes=130 kosovo.osm) I tried your template.args file, it didn't get stuck, finished in less than 2 mins. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Why are all the un-named peaks called '6140565'?
Hi Someoneelse, Is 6140565 the last name in the .osm file being processed at that time? I've seen a similar effect with all unnamed natural=peak being named YHA Ravenstor (which happened to be the last name in the file that I was processing at the time). As to how to fix it; haven't a clue... That's interesting to learn. In this case, 6140565 does appear as a tag value: node id='27424899' lat='55.8449129' lon='-4.4298279' tag k='highway' v='bus_stop'/ tag k='nat_ref' v='6140565'/ /node Hey, that's a really great bug, it causes anonymous peaks to be named in honour of a bus stop! Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] mkgmap gets stuck on Kosovo - is related to -c template.args
Chill Felix, Sorry, I had a syntax error here that caused mkgmap to pass when not using template.args (and outputting a 0kb map). It's using location-autofill=2 and my style-file which will cause mkgmap to get stuck on kosovo (as well as on some more countries like recently Slovakia). I am looking at that now. ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] mkgmap gets stuck on Kosovo - is related to -c template.args
Felix, The problem is triggered by the fact that in your style file you give anonymous roads of the same type, the same name i.e. 'rd', 'trk', 'ucl', etc. So the map ends up containing lot's of roads with the same names. The kosovo map contains a huge number of anonymous roads. The code that is getting stuck is trying to find all of the roads that have the same name and are associated with the same city and are connected to each other. Perhaps, and this is a guess, the autofill=2 option increases the number of roads that have the same city such that it becomes computationally, very expensive to work out which roads are connected to each other. It may well finish if you wait long enough! Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Why are all the un-named peaks called '6140565'?
Hi Clinton, On Sun, Mar 14, 2010 at 11:29 PM, Mark Burton ma...@ordern.com wrote: Hey, that's a really great bug, it causes anonymous peaks to be named in honour of a bus stop! This may be caused by the def (default value) and height filters. I believe the statement is attempting the following: 1. ${name|def:} use either the 'name' value, or as default '' (empty string). 2. ${ele|height:m=ft|def:} Convert the elevation in meters to feet. If no 'ele' value is present, use an empty string. I have a feeling that the empty string part may be misinterpreted right now. It could be that the last value found is instead used. The relevant files are below, if you want to debug: DefaultFilter.java - called for the 'def' filter. HeightFilter.java - called for the 'height' filter (a subclass of ConvertFilter.java) ValueBuilder.java - instantiates the filter classes. This would be a good place to start. Thanks for the info - I started to nose around in that area but haven't got far - I shall take another look this evening. One thing that struck me was (somewhere in that code) I saw where it was testing to see if a passed in String value was null but it didn't test if it was zero-length. So, like you above, I wonder if the empty default value is causing problems. Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Why are all the un-named peaks called '6140565'?
Steve, It turns out that the problem is Labels that are empty but not null. All such labels, however generated, show as whatever label was defined right after the first empty one. The attached patch should fix it. That looks better, thanks. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v1] - Code around highway shield crap when sorting labels
This patch codes around the problems introduced by highway shields with regard to the sorted roads: 1 - the sort order should now be much improved 2 - no duplicate symbols (shield version + non-shield version) It also includes a fix to the label reading code so that labels with a highway shield prefix are read in correctly when generating the MDR file. For me, in mapsource, road search for roads with highway shields now works apart from motorways which don't seem to searchable - perhaps that's deliberate on Garmin's part? All feedback appreciated. Mark diff --git a/src/uk/me/parabola/imgfmt/app/Label.java b/src/uk/me/parabola/imgfmt/app/Label.java index c7ca3a3..bbf7549 100644 --- a/src/uk/me/parabola/imgfmt/app/Label.java +++ b/src/uk/me/parabola/imgfmt/app/Label.java @@ -56,6 +56,16 @@ public class Label implements ComparableLabel { return text; } + public String getTextSansGarminCodes() { + return stripGarminCodes(text); + } + + public static String stripGarminCodes(String s) { + if(s == null) + return null; + return s.replaceAll([\u0001-\u0006\u001b-\u001f],); + } + /** * The offset of this label in the LBL file. The first byte of this file * is zero and an offset of zero means that the label has a zero length/is diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java index ec226a1..d1a267d 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java @@ -41,7 +41,7 @@ public class Format6Encoder extends BaseEncoder implements CharacterEncoder { public static final String LETTERS = ABCDEFGHIJKLMNO + // 0x00-0x0F PQRSTUVWXYZxx+ // 0x10-0x1F - 0123456789xx; // 0x20-0x2F + 0123456789\u0001\u0002\u0003\u0004\u0005\u0006; // 0x20-0x2F public static final String SYMBOLS = @!\#$%'()*+,-./ + // 0x00-0x0F diff --git a/src/uk/me/parabola/imgfmt/app/lbl/City.java b/src/uk/me/parabola/imgfmt/app/lbl/City.java index 4fc7939..2ae6389 100644 --- a/src/uk/me/parabola/imgfmt/app/lbl/City.java +++ b/src/uk/me/parabola/imgfmt/app/lbl/City.java @@ -118,7 +118,7 @@ public class City implements ComparableCity { if(label != null) result += label.getText(); if (subdivision != null) - result += subdivision.getNumber() + / + pointIndex; + result += + subdivision.getNumber() + / + pointIndex; if(country != null) result += in country + (0 + country.getIndex()); if(region != null) diff --git a/src/uk/me/parabola/imgfmt/app/net/NETFile.java b/src/uk/me/parabola/imgfmt/app/net/NETFile.java index 82f220b..e7abf26 100644 --- a/src/uk/me/parabola/imgfmt/app/net/NETFile.java +++ b/src/uk/me/parabola/imgfmt/app/net/NETFile.java @@ -18,8 +18,11 @@ package uk.me.parabola.imgfmt.app.net; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import uk.me.parabola.imgfmt.Utils; import uk.me.parabola.imgfmt.app.BufferedImgFileWriter; @@ -61,23 +64,44 @@ public class NETFile extends ImgFile { public void writePost(ImgFileWriter rgn, boolean sortRoads) { ListSortableLabel, RoadDef sortedRoads = new ArrayListSortableLabel, RoadDef(roads.size()); + // cleanedLabels holds cleaned up versions of the Label + // strings that are used when sorting the road names - the + // hope is that retrieving the String from the Map is faster than + // cleaning the Label text for each comparison in the sort + final MapLabel, String cleanedLabels = new HashMapLabel, String(); for (RoadDef rd : roads) { rd.writeRgnOffsets(rgn); if(sortRoads) { Label[] l = rd.getLabels(); -for(int i = 0; i l.length l[i] != null; ++i) - if(l[i].getLength() != 0) +for(int i = 0; i l.length l[i] != null; ++i) { + if(l[i].getLength() != 0) { + cleanedLabels.put(l[i], l[i].getTextSansGarminCodes()); + // System.err.println(Road + rd + has label + l[i]); sortedRoads.add(new SortableLabel, RoadDef(l[i], rd)); + } +} } } if(sortedRoads.size() 0) { - Collections.sort(sortedRoads); + Collections.sort(sortedRoads, new ComparatorSortableLabel, RoadDef() { + public int compare(SortableLabel, RoadDef a, SortableLabel, RoadDef b) { + // sort using cleaned versions of the labels + int diff = cleanedLabels.get(a.getKey()).compareToIgnoreCase(cleanedLabels.get(b.getKey())); + if(diff != 0) + return diff; + // the labels were the same, sort on the + // RoadDefs + return a.getValue().compareTo(b.getValue()); + } +}); sortedRoads = simplifySortedRoads(new LinkedListSortableLabel, RoadDef(sortedRoads)); ImgFileWriter writer = netHeader.makeSortedRoadWriter(getWriter()); - for(SortableLabel, RoadDef srd : sortedRoads) + for(SortableLabel, RoadDef srd : sortedRoads) { +
[mkgmap-dev] [PATCH v2] - Code around highway shield crap when sorting labels
v2 - remove more duplicate labels that only differ in letter case - remove leading spaces from labels even if they start with a Garmin code. Still something wrong with motorway names because on the UK map, only the M74 appears in the mapsource road names - all other motorways are missing - very odd. --- This patch codes around the problems introduced by highway shields with regard to the sorted roads: 1 - the sort order should now be much improved 2 - no duplicate symbols (shield version + non-shield version) It also includes a fix to the label reading code so that labels with a highway shield prefix are read in correctly when generating the MDR file. For me, in mapsource, road search for roads with highway shields now works apart from motorways which don't seem to searchable - perhaps that's deliberate on Garmin's part? All feedback appreciated. Mark diff --git a/src/uk/me/parabola/imgfmt/app/Label.java b/src/uk/me/parabola/imgfmt/app/Label.java index c7ca3a3..bbf7549 100644 --- a/src/uk/me/parabola/imgfmt/app/Label.java +++ b/src/uk/me/parabola/imgfmt/app/Label.java @@ -56,6 +56,16 @@ public class Label implements ComparableLabel { return text; } + public String getTextSansGarminCodes() { + return stripGarminCodes(text); + } + + public static String stripGarminCodes(String s) { + if(s == null) + return null; + return s.replaceAll([\u0001-\u0006\u001b-\u001f],); + } + /** * The offset of this label in the LBL file. The first byte of this file * is zero and an offset of zero means that the label has a zero length/is diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java index 0dc8390..fd06368 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java @@ -65,7 +65,7 @@ public class BaseEncoder { return new EncodedText(out, out.length); } - protected boolean isUpperCase() { + public boolean isUpperCase() { return upperCase; } diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java index ec226a1..d1a267d 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java @@ -41,7 +41,7 @@ public class Format6Encoder extends BaseEncoder implements CharacterEncoder { public static final String LETTERS = ABCDEFGHIJKLMNO + // 0x00-0x0F PQRSTUVWXYZxx+ // 0x10-0x1F - 0123456789xx; // 0x20-0x2F + 0123456789\u0001\u0002\u0003\u0004\u0005\u0006; // 0x20-0x2F public static final String SYMBOLS = @!\#$%'()*+,-./ + // 0x00-0x0F diff --git a/src/uk/me/parabola/imgfmt/app/lbl/City.java b/src/uk/me/parabola/imgfmt/app/lbl/City.java index 4fc7939..2ae6389 100644 --- a/src/uk/me/parabola/imgfmt/app/lbl/City.java +++ b/src/uk/me/parabola/imgfmt/app/lbl/City.java @@ -118,7 +118,7 @@ public class City implements ComparableCity { if(label != null) result += label.getText(); if (subdivision != null) - result += subdivision.getNumber() + / + pointIndex; + result += + subdivision.getNumber() + / + pointIndex; if(country != null) result += in country + (0 + country.getIndex()); if(region != null) diff --git a/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java b/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java index 4d88bab..a2422ea 100644 --- a/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java +++ b/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java @@ -17,6 +17,7 @@ package uk.me.parabola.imgfmt.app.lbl; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import uk.me.parabola.imgfmt.Utils; @@ -27,6 +28,7 @@ import uk.me.parabola.imgfmt.app.Label; import uk.me.parabola.imgfmt.app.labelenc.BaseEncoder; import uk.me.parabola.imgfmt.app.labelenc.CharacterEncoder; import uk.me.parabola.imgfmt.app.labelenc.CodeFunctions; +import uk.me.parabola.imgfmt.app.labelenc.Format6Encoder; import uk.me.parabola.imgfmt.app.trergn.Subdivision; import uk.me.parabola.imgfmt.fs.ImgChannel; import uk.me.parabola.log.Logger; @@ -107,6 +109,13 @@ public class LBLFile extends ImgFile { * @return A reference to the created label. */ public Label newLabel(String text) { + // if required, fold case now so that labelCache doesn't + // contain multiple labels that only differ in letter case + if(text != null + (textEncoder instanceof Format6Encoder || + textEncoder instanceof BaseEncoder + ((BaseEncoder)textEncoder).isUpperCase())) + text = text.toUpperCase(Locale.ENGLISH); Label l = labelCache.get(text); if (l == null) { l = new Label(text); diff --git a/src/uk/me/parabola/imgfmt/app/net/NETFile.java b/src/uk/me/parabola/imgfmt/app/net/NETFile.java index 82f220b..e7abf26 100644 --- a/src/uk/me/parabola/imgfmt/app/net/NETFile.java +++ b/src/uk/me/parabola/imgfmt/app/net/NETFile.java @@ -18,8 +18,11 @@ package
Re: [mkgmap-dev] Broken Routes based on mkgmap map due to functional characters inside name
Hi Clinton, Felix, Hi, I just got this comment yesterday via my homepage. Seemingly mkgmap in some circumstances puts ENQ - functional characters into the name of streets (when adding the name from a route relation). ENQ is ASCII 0x05, which is one of the codes for highway shields. Perhaps Mark's patch to code around this crap would also help here? As it stands, probably not, but having recently become a little knowledgeable about this stuff I can guess what's happening. So I will make a new patch that could possibly help with this issue. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v3] - Code around highway shield crap when sorting labels
v3 - now works harder to clean up road names for use in MDR file - not sure if this will have a beneficial effect but it could possibly fix the issue recently reported by Felix. Motorways are still not showing up. --- v2 - remove more duplicate labels that only differ in letter case - remove leading spaces from labels even if they start with a Garmin code. Still something wrong with motorway names because on the UK map, only the M74 appears in the mapsource road names - all other motorways are missing - very odd. --- This patch codes around the problems introduced by highway shields with regard to the sorted roads: 1 - the sort order should now be much improved 2 - no duplicate symbols (shield version + non-shield version) It also includes a fix to the label reading code so that labels with a highway shield prefix are read in correctly when generating the MDR file. For me, in mapsource, road search for roads with highway shields now works apart from motorways which don't seem to searchable - perhaps that's deliberate on Garmin's part? All feedback appreciated. Mark diff --git a/src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java b/src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java index bcb1867..7b2cff8 100644 --- a/src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java +++ b/src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java @@ -148,11 +148,7 @@ public class MDRFile extends ImgFile { * @return The name as it will go into the index. */ private String cleanUpName(String name) { - // TODO Currently just drop an initial shield, but more to do - if (name.charAt(0) ' ') - return name.substring(1); - - return name; + return Label.stripGarminCodes(name); } public void write() { ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v3] - Code around highway shield crap when sorting labels
Hi Clinton, On Mar 18, 2010, at 22:49, Mark Burton wrote: v3 - now works harder to clean up road names for use in MDR file Er... this patch needs to be applied on top of the v2 patch does it not? It just patches the MDR file, but does not contain the patches to all the other files from the v2 patch. Did you perhaps forget to include the v2 stuff? Silly me, that's exactly what happened. I'm still working on why the motorways are mostly missing and maybe will have another patch sometime so I will issue an update later. Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v4] - Code around highway shield crap when sorting labels
v4 - found the motorways (and a load of other roads too!) v3 - now works harder to clean up road names for use in MDR file - not sure if this will have a beneficial effect but it could possibly fix the issue recently reported by Felix. Motorways are still not showing up. --- v2 - remove more duplicate labels that only differ in letter case - remove leading spaces from labels even if they start with a Garmin code. Still something wrong with motorway names because on the UK map, only the M74 appears in the mapsource road names - all other motorways are missing - very odd. --- This patch codes around the problems introduced by highway shields with regard to the sorted roads: 1 - the sort order should now be much improved 2 - no duplicate symbols (shield version + non-shield version) It also includes a fix to the label reading code so that labels with a highway shield prefix are read in correctly when generating the MDR file. For me, in mapsource, road search for roads with highway shields now works apart from motorways which don't seem to searchable - perhaps that's deliberate on Garmin's part? All feedback appreciated. Mark diff --git a/src/uk/me/parabola/imgfmt/app/Label.java b/src/uk/me/parabola/imgfmt/app/Label.java index c7ca3a3..bbf7549 100644 --- a/src/uk/me/parabola/imgfmt/app/Label.java +++ b/src/uk/me/parabola/imgfmt/app/Label.java @@ -56,6 +56,16 @@ public class Label implements ComparableLabel { return text; } + public String getTextSansGarminCodes() { + return stripGarminCodes(text); + } + + public static String stripGarminCodes(String s) { + if(s == null) + return null; + return s.replaceAll([\u0001-\u0006\u001b-\u001f],); + } + /** * The offset of this label in the LBL file. The first byte of this file * is zero and an offset of zero means that the label has a zero length/is diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java index 0dc8390..fd06368 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java @@ -65,7 +65,7 @@ public class BaseEncoder { return new EncodedText(out, out.length); } - protected boolean isUpperCase() { + public boolean isUpperCase() { return upperCase; } diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java index ec226a1..d1a267d 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Encoder.java @@ -41,7 +41,7 @@ public class Format6Encoder extends BaseEncoder implements CharacterEncoder { public static final String LETTERS = ABCDEFGHIJKLMNO + // 0x00-0x0F PQRSTUVWXYZxx+ // 0x10-0x1F - 0123456789xx; // 0x20-0x2F + 0123456789\u0001\u0002\u0003\u0004\u0005\u0006; // 0x20-0x2F public static final String SYMBOLS = @!\#$%'()*+,-./ + // 0x00-0x0F diff --git a/src/uk/me/parabola/imgfmt/app/lbl/City.java b/src/uk/me/parabola/imgfmt/app/lbl/City.java index 4fc7939..2ae6389 100644 --- a/src/uk/me/parabola/imgfmt/app/lbl/City.java +++ b/src/uk/me/parabola/imgfmt/app/lbl/City.java @@ -118,7 +118,7 @@ public class City implements ComparableCity { if(label != null) result += label.getText(); if (subdivision != null) - result += subdivision.getNumber() + / + pointIndex; + result += + subdivision.getNumber() + / + pointIndex; if(country != null) result += in country + (0 + country.getIndex()); if(region != null) diff --git a/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java b/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java index 4d88bab..a2422ea 100644 --- a/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java +++ b/src/uk/me/parabola/imgfmt/app/lbl/LBLFile.java @@ -17,6 +17,7 @@ package uk.me.parabola.imgfmt.app.lbl; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import uk.me.parabola.imgfmt.Utils; @@ -27,6 +28,7 @@ import uk.me.parabola.imgfmt.app.Label; import uk.me.parabola.imgfmt.app.labelenc.BaseEncoder; import uk.me.parabola.imgfmt.app.labelenc.CharacterEncoder; import uk.me.parabola.imgfmt.app.labelenc.CodeFunctions; +import uk.me.parabola.imgfmt.app.labelenc.Format6Encoder; import uk.me.parabola.imgfmt.app.trergn.Subdivision; import uk.me.parabola.imgfmt.fs.ImgChannel; import uk.me.parabola.log.Logger; @@ -107,6 +109,13 @@ public class LBLFile extends ImgFile { * @return A reference to the created label. */ public Label newLabel(String text) { + // if required, fold case now so that labelCache doesn't + // contain multiple labels that only differ in letter case + if(text != null + (textEncoder instanceof Format6Encoder || + textEncoder instanceof BaseEncoder + ((BaseEncoder)textEncoder).isUpperCase())) + text = text.toUpperCase(Locale.ENGLISH); Label l = labelCache.get(text); if (l == null) { l = new
Re: [mkgmap-dev] map detects barriers like gate as passable by motor vehicle when it is only restricted to pedestrians
Hi Paul, I'm curious how mkgmap handles permissive, private, and destination access types myself. 'permissive' is considered to be the same as 'yes' and 'designated'. 'private' is considered to be the same as 'no'. 'destination' routing on a way(s) should stop the gps routing through those ways unless the destination is within those ways or there is no other route to the destination. Note that destination routing only seems to have an effect on motorcar/motorbike routing - it doesn't appear to effect the other vehicle types. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v4] - Code around highway shield crap when sorting labels
Felix, okay searching for roads works very well now. Good. However the ENQ problem is not solved for me. Using: /set ref = '${ref}'/ inside relations file for relations that have a ref (like EV6) and then /{ set name='${ref|highway-symbol:box:6:4} ${name}' | '${ref|highway-symbol:box:6:4}'; add display_name='${name}'}/ inside lines file, causes mkgmap to create these havoc names. Sorry, once again, I am nonplussed by the style syntax, what does the 6:4 mean in the above? If read with mapedit name looks like this: ~[0x2f]EV6 ~[0x2e]EV6 DONAURADWEG inside Mapsource it looks like this: EV6 | EV6 DONAURADWEG Clearly mkgmap has some problem here. There is nowhere at all where I ask [0x2f] or [0x2e] to be included into the name. Furthermore is neither 0x2f nor 0x2e the type of the road. Well, the 0x2f and 0x2e are the 6-bit encodings of the Oval and Box shields so at least one of those matches what your doing above but I can't see how the Oval code is getting in there. Do you have some other rule that adds an Oval shield? So I wonder if the problem is that your ending up with a highway shield code embedded in the name rather than being a prefix. Perhaps, it can only cope with prefix shields. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v4] - Code around highway shield crap when sorting labels
Felix, Sorry, once again, I am nonplussed by the style syntax, what does the 6:4 mean in the above? This means 6 characters maximum, or 4 non numeric characters maximum if I remember it correctly. Default is 7:5 if I remember correctly. OK - thanks. Well, the 0x2f and 0x2e are the 6-bit encodings of the Oval and Box shields so at least one of those matches what your doing above but I can't see how the Oval code is getting in there. Do you have some other rule that adds an Oval shield? No, the full rules for the highway shields are as follows (I don't think there is a bug inside on my part): ( extremecarver=mr | route=mtb ) ref=* { set name='${ref|hig2f4b | 01 38 00| 3 byte stream hway-symbol:hbox:6:4} ${name}' | '${ref|highway-symbol:hbox:6:4}'; add display_name='${name}'} extremecarver5=bike ref=* extremecarver!=mr route!=mtb { set name='${ref|highway-symbol:box:6:4} ${name}' | '${ref|highway-symbol:box:6:4}'; add display_name='${name}'} highway=* ref=* extremcaver5!=bike extremecarver!=mr route!=mtb { set name='${ref|highway-symbol:oval:6:4} ${name}' | '${ref|highway-symbol:oval:6:4}'; add display_name='${name}'} Yes, you do have another rule that adds an oval shield (the last one above). So what's happening is that two of the rules are matching and you are getting both a box and an oval shield added to the name - and that's badness. So I wonder if the problem is that your ending up with a highway shield code embedded in the name rather than being a prefix. Perhaps, it can only cope with prefix shields. I don't understand what you mean with /being a prefix/. What I mean is that the highway shield code has to prefix (go at the front) of the name and not be embedded within the name string. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v4] - Code around highway shield crap when sorting labels
BTW - do you think this v4 patch is working well enough to commit now? ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v4] - Code around highway shield crap when sorting labels
Hi Clinton, BTW - do you think this v4 patch is working well enough to commit now? yes Me too! :-) Good and thanks for the earlier +ve report. Unless anything untoward crops up, I shall commit it later today. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] setting display_name to name
Folks, You can see the additional label will only be added if it differs from the name after the Garmin codes have been stripped from the name. Sure, what's the point in having multiple labels the same (apart from the shield code)? Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] map detects barriers like gate as passable by motor vehicle when it is only restricted to pedestrians
Hi Paul, Hmm, I would have thought permissive would have been the same as destination but with preference given to permissive routes as a tiebreaker. The Garmin doesn't do permissive - it really only does yes or no so the choice is one of: permissive = yes permissive = no permissive is ignored Yonks ago I decided that permissive was more like yes than no so that's how it is treated in mkgmap. Does it still route down a no or private if there's not any other option? I think that's the case but I haven't checked for a long time. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] setting display_name to name
Felix, I'm not setting multiple labels. The display_name is the name shown for routing instructions. If not set, the ref alone will be taken instead. So instead of say left on A11 Westautobahn the GPS will only say left on A11. Hmm, for me, I still get the longer routing instruction. For example, if the first label is B5395 (with a highway shield prefix) and the second label (set through display_name) is Oldhall Street (B5395), then the routing instructions is: Turn right onto Oldhall Street (B5395) 2.5 km 1.5 km 0:02:16 0:03:44 46° trueN53.02019 W2.76553 The patch we're currently evaluating hasn't changed that behaviour. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v5] - Code around highway shield crap when sorting labels
v5 - now understands the 0x1b prefix code that introduces a lower case letter (and also is used to prefix a couple of separators (0x1b and 0x1c). I thought great, now I can prefix my road names with ^\ (aka 0x1c) and they won't show up so readily when zoomed out. That worked as expected but, unfortunately, it broke the address search stuff so the bottom line is that you can't use the separators as a prefix (sob). Also, for those of you wondering why the display names and other refs are not showing up in the mapsource address search - it's because the MDR building code only reads the first label for a road and ignores any others. Shame that. I don't think there's a good reason why it couldn't read the other labels, it's just doesn't do that at the moment. BTW - the basic address search on the etrex and Nuvi still sees those alternative road labels. So, those people who are tracking this patch series, please test and if it doesn't bite your arse, I will commit it soonish v4 - found the motorways (and a load of other roads too!) v3 - now works harder to clean up road names for use in MDR file - not sure if this will have a beneficial effect but it could possibly fix the issue recently reported by Felix. Motorways are still not showing up. --- v2 - remove more duplicate labels that only differ in letter case - remove leading spaces from labels even if they start with a Garmin code. Still something wrong with motorway names because on the UK map, only the M74 appears in the mapsource road names - all other motorways are missing - very odd. --- This patch codes around the problems introduced by highway shields with regard to the sorted roads: 1 - the sort order should now be much improved 2 - no duplicate symbols (shield version + non-shield version) It also includes a fix to the label reading code so that labels with a highway shield prefix are read in correctly when generating the MDR file. For me, in mapsource, road search for roads with highway shields now works apart from motorways which don't seem to searchable - perhaps that's deliberate on Garmin's part? All feedback appreciated. Mark diff --git a/src/uk/me/parabola/imgfmt/app/Label.java b/src/uk/me/parabola/imgfmt/app/Label.java index c7ca3a3..149205b 100644 --- a/src/uk/me/parabola/imgfmt/app/Label.java +++ b/src/uk/me/parabola/imgfmt/app/Label.java @@ -56,6 +56,19 @@ public class Label implements ComparableLabel { return text; } + public String getTextSansGarminCodes() { + return stripGarminCodes(text); + } + + public static String stripGarminCodes(String s) { + if(s == null) + return null; + s = s.replaceAll([\u0001-\u0006\u001b-\u001c], ); // remove highway shields and thin separators + s = s.replaceAll([\u001d-\u001f], ); // replace fat separators with spaces + // a leading separator would have turned into a space so trim it + return s.trim(); + } + /** * The offset of this label in the LBL file. The first byte of this file * is zero and an offset of zero means that the label has a zero length/is diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java index 0dc8390..fd06368 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java @@ -65,7 +65,7 @@ public class BaseEncoder { return new EncodedText(out, out.length); } - protected boolean isUpperCase() { + public boolean isUpperCase() { return upperCase; } diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java index 079ef4c..f4547cd 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java @@ -11,6 +11,7 @@ public class Format6Decoder implements CharacterDecoder { private boolean needReset; private boolean symbol; + private boolean lowerCaseOrSeparator; private int store; private int nbits; @@ -77,20 +78,40 @@ public class Format6Decoder implements CharacterDecoder { if (symbol) { symbol = false; c = Format6Encoder.SYMBOLS.charAt(b); - } else { + } + else if(lowerCaseOrSeparator) { + lowerCaseOrSeparator = false; + if(b == 0x2b || b == 0x2c) { +c = (char)(b - 0x10); // thin separator + } + else if(Character.isLetter(b)) { +// lower case letter +c = Character.toLowerCase(Format6Encoder.LETTERS.charAt(b)); + } + else { +// not a letter so just use as is (could be a digit) +c = Format6Encoder.LETTERS.charAt(b); + } + } + else { switch(b) { case 0x1B: -// perhaps this is next-char lower case? +// next char is lower case or a separator +lowerCaseOrSeparator = true; return; + case 0x1C: // next char is symbol symbol = true; return; + case 0x1D: case 0x1E: case 0x1F: -// these define abbreviations; fall
Re: [mkgmap-dev] setting display_name to name
Felix, The patch for the patch by Clinton, allows that display_name can be identical to name and I find it pretty useful. I am very slow - please spell it out for me. How does having two labels that are the same apart from the first one having a highway shield prefix behave any differently from just having the first label on its own? I don't understand the benefit. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] setting display_name to name
Felix, Your version 4, disallowed setting display_name and name to the same value. Actually, display_name isn't really handled specially at all, it's just the same as any other ref but it goes to the head of the ref queue. i.e if you have: name = peach ref = banana;orange display_name = kiwi the labels get output in this order: peach kiwi banana orange ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] setting display_name to name
Hi Clinton, Sure, what's the point in having multiple labels the same (apart from the shield code)? I suppose because Felix said so isn't a good argument is it? ;-) I think that I have twigged what the issue is - I think what Felix is possibly looking at this situation: name = shieldcarp ref = shark display_name = carp But with my patch the labels output are: shieldcarp shark And so shark will be used in the routing instructions when he wants carp. OK - if that's what the issue is, I am going to change the code to only trash the ref if it's the only ref (and the same as the name sans shields) but if there is multiple refs then none of them will get trashed. I will post a v6 patch tonight Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v5] - Code around highway shield crap when sorting labels
Felix, Your right, it would really be needed that all of the three combinations of name and ref are searchable independently. name ref name ref All it requires is that all of the labels that are attached to a road are read in by the MDR generating code. Where those labels got their values from initially (name, ref, display_name, int_ref, ...) is irrelevant as far as the MDR is concerned. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] setting display_name to name
Felix, Thanks for the explanation - I was hoping you would write English rather than style language as I understand that about as well as I understand German language! Anyway, I think I have worked out what the issue is. It's because there are trailing labels following and they get shown instead of the display name. I will post a v6 patch tonight that should fix that. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v6] - Code around highway shield crap when sorting labels
v6 - don't trash first ref if it is the same as the name (sans shield) and more refs follow - v5 - now understands the 0x1b prefix code that introduces a lower case letter (and also is used to prefix a couple of separators (0x1b and 0x1c). I thought great, now I can prefix my road names with ^\ (aka 0x1c) and they won't show up so readily when zoomed out. That worked as expected but, unfortunately, it broke the address search stuff so the bottom line is that you can't use the separators as a prefix (sob). Also, for those of you wondering why the display names and other refs are not showing up in the mapsource address search - it's because the MDR building code only reads the first label for a road and ignores any others. Shame that. I don't think there's a good reason why it couldn't read the other labels, it's just doesn't do that at the moment. BTW - the basic address search on the etrex and Nuvi still sees those alternative road labels. So, those people who are tracking this patch series, please test and if it doesn't bite your arse, I will commit it soonish v4 - found the motorways (and a load of other roads too!) v3 - now works harder to clean up road names for use in MDR file - not sure if this will have a beneficial effect but it could possibly fix the issue recently reported by Felix. Motorways are still not showing up. --- v2 - remove more duplicate labels that only differ in letter case - remove leading spaces from labels even if they start with a Garmin code. Still something wrong with motorway names because on the UK map, only the M74 appears in the mapsource road names - all other motorways are missing - very odd. --- This patch codes around the problems introduced by highway shields with regard to the sorted roads: 1 - the sort order should now be much improved 2 - no duplicate symbols (shield version + non-shield version) It also includes a fix to the label reading code so that labels with a highway shield prefix are read in correctly when generating the MDR file. For me, in mapsource, road search for roads with highway shields now works apart from motorways which don't seem to searchable - perhaps that's deliberate on Garmin's part? All feedback appreciated. Mark diff --git a/src/uk/me/parabola/imgfmt/app/Label.java b/src/uk/me/parabola/imgfmt/app/Label.java index c7ca3a3..149205b 100644 --- a/src/uk/me/parabola/imgfmt/app/Label.java +++ b/src/uk/me/parabola/imgfmt/app/Label.java @@ -56,6 +56,19 @@ public class Label implements ComparableLabel { return text; } + public String getTextSansGarminCodes() { + return stripGarminCodes(text); + } + + public static String stripGarminCodes(String s) { + if(s == null) + return null; + s = s.replaceAll([\u0001-\u0006\u001b-\u001c], ); // remove highway shields and thin separators + s = s.replaceAll([\u001d-\u001f], ); // replace fat separators with spaces + // a leading separator would have turned into a space so trim it + return s.trim(); + } + /** * The offset of this label in the LBL file. The first byte of this file * is zero and an offset of zero means that the label has a zero length/is diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java index 0dc8390..fd06368 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/BaseEncoder.java @@ -65,7 +65,7 @@ public class BaseEncoder { return new EncodedText(out, out.length); } - protected boolean isUpperCase() { + public boolean isUpperCase() { return upperCase; } diff --git a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java index 079ef4c..f4547cd 100644 --- a/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java +++ b/src/uk/me/parabola/imgfmt/app/labelenc/Format6Decoder.java @@ -11,6 +11,7 @@ public class Format6Decoder implements CharacterDecoder { private boolean needReset; private boolean symbol; + private boolean lowerCaseOrSeparator; private int store; private int nbits; @@ -77,20 +78,40 @@ public class Format6Decoder implements CharacterDecoder { if (symbol) { symbol = false; c = Format6Encoder.SYMBOLS.charAt(b); - } else { + } + else if(lowerCaseOrSeparator) { + lowerCaseOrSeparator = false; + if(b == 0x2b || b == 0x2c) { +c = (char)(b - 0x10); // thin separator + } + else if(Character.isLetter(b)) { +// lower case letter +c = Character.toLowerCase(Format6Encoder.LETTERS.charAt(b)); + } + else { +// not a letter so just use as is (could be a digit) +c = Format6Encoder.LETTERS.charAt(b); + } + } + else { switch(b) { case 0x1B: -// perhaps this is next-char lower case? +// next char is lower case or a separator +lowerCaseOrSeparator = true; return; + case 0x1C: // next char is symbol symbol = true;
Re: [mkgmap-dev] debugging ferries
Hello Chris, I found that I had to set the ferry road class to 3 to be able to reliably route using them. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Commit: r1609: Use road_class 3 for route=ferry.
Use road_class 3 for route=ferry. Mark Burton says that this is needed for reliable routing. That was rather quick. Let's hope I'm right. As for evidence, here's an example route that has uses two ferries and has no intermediate way points. Mark attachment: ferry-routing.png___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] process same input data with mkgmap with different styles at the same time
Hello Christoph, Hello list, I try to make Garmin maps with different layers. http://wiki.openstreetmap.org/wiki/All_in_one_Garmin_Map The idea is, that you can enable or disable some transparent maps that you won't see. For this reason I use mkgmap with different options and stylefiles multiple times on the same input data: java -ea -jar mkgmap.jar [options1] --style-file=style1 input_data java -ea -jar mkgmap.jar [options2] --style-file=style2 input_data java -ea -jar mkgmap.jar [options3] --style-file=style3 input_data ... This works good, but is not with so good performance as it could be. The input data are gzipped osm-tiles of europe and everytime mkgmap runs it has to decompress and parse the same stuff. The cleverst solution I could imagine is to start mkgmap once and give it different options at the same time for different threads for example: java -ea -jar mkgmap.jar [options1] --style-file=style1 --outputdir=dir1 [options2] --style-file=style2 --outputdir=dir2 [options3] --style-file=style3 --outputdir=dir3 input_data The question is: How difficult is it to implement in mkgmap? I looked at the source code but didn't understand enough to implement it. In germany we would say I looked at the code like a pig at a clockwork. ;) That's a great phrase! But to answer your question. I think it would be a lot of work to do what you are suggesting and really not the best solution. If I was trying to do what you are doing I would simply de-compress the input once (disk space is cheap) and then run separate mkgmap sessions as before. You could also pre-process the XML to filter out all of the crap tags that you are not interested in. That would speed up the processing by mkgmap. I think a problem is that at the moment the order of commandline args doesn't matter but then it would be important which option belongs to which thread. Maybe another solution could be to build a cache - like the tilesplittercache, where mkgmap can store the parsed input_data. Another mkgmap instance could use this cache instead of the input data. Maybe this solution would be more easy to implement or am I wrong? So something like: java -ea -jar mkgmap.jar [options1] --style-file=style1 --write-cache=cachdir input_data java -ea -jar mkgmap.jar [options2] --style-file=style2 --read-cache=cachdir java -ea -jar mkgmap.jar [options3] --style-file=style3 --read-cache=cachdir What do you think about that ideas? Btw: Can I specify an output directory for mkgmap or is it everytime the actual directory? Thanks! Christoph Cheers, Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] [PATCH v6] - Code around highway shield crap when sorting labels
Hi Felix, On 22.03.2010 00:42, Mark Burton wrote: v6 - don't trash first ref if it is the same as the name (sans shield) and more refs follow - In principle the patch works very good. Good. I do get complications when using this patch in combination to Wan Mill's mp_lesscuts_v4.patch. Isn't that patch already in the trunk? It would be great if the following patches could be added to trunk, for me they all work very well: empty_labels.patch This is also in trunk now. mp_lesscuts_v4.patch (causes some problems in combination with above patch v6) mp_rolehandling_v3.patch sizeFilter.patch (previously called drop_small_polygons.patch) Don't know the status of those patches. java.lang.NullPointerException at uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation.closeWays(MultiPolygonRelation.java:327) at uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation.processElements(MultiPolygonRelation.java:538) Actually, if you look at the code, that NPE should be impossible to achieve. Something very odd is happening - can you try again using a clean build (ant clean; ant) Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] rolehandling patch
Hi Steve, Steve's been handling the MP patches, hopefully he will look at incorporating that patch. All of that patch (as far as I can see) was included in the r1607 patch. Oh yes, it's already been done. I've been so immersed in my own little world that I missed that one. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] Minimum size patch installed
The patch to support different min sizes for lines and polys has now be committed. I added a couple of options so that the default values (1 and 8 as per the original patch) can be changed if required. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[mkgmap-dev] [PATCH v1] squash spaces in labels
This patch squashes spaces in label strings so that High Street becomes High Street. Is there any reason why we would want to preserve multiple spaces? Mark diff --git a/src/uk/me/parabola/imgfmt/app/Label.java b/src/uk/me/parabola/imgfmt/app/Label.java index 149205b..ec2b11a 100644 --- a/src/uk/me/parabola/imgfmt/app/Label.java +++ b/src/uk/me/parabola/imgfmt/app/Label.java @@ -69,6 +69,12 @@ public class Label implements ComparableLabel { return s.trim(); } + public static String squashSpaces(String s) { + if(s == null) + return null; + return s.replaceAll(\\s\\s+, ); + } + /** * The offset of this label in the LBL file. The first byte of this file * is zero and an offset of zero means that the label has a zero length/is diff --git a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java index de58e11..da365b0 100644 --- a/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java +++ b/src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java @@ -30,6 +30,7 @@ import uk.me.parabola.imgfmt.app.Area; import uk.me.parabola.imgfmt.app.Coord; import uk.me.parabola.imgfmt.app.CoordNode; import uk.me.parabola.imgfmt.app.Exit; +import uk.me.parabola.imgfmt.app.Label; import uk.me.parabola.imgfmt.app.net.NODHeader; import uk.me.parabola.imgfmt.app.trergn.ExtTypeAttributes; import uk.me.parabola.log.Logger; @@ -550,22 +551,22 @@ public class StyledConverter implements OsmConverter { } private String combineRefs(Element element) { - String ref = element.getTag(ref); - String int_ref = element.getTag(int_ref); + String ref = Label.squashSpaces(element.getTag(ref)); + String int_ref = Label.squashSpaces(element.getTag(int_ref)); if(int_ref != null) { if(ref == null) ref = int_ref; else ref += ; + int_ref; } - String nat_ref = element.getTag(nat_ref); + String nat_ref = Label.squashSpaces(element.getTag(nat_ref)); if(nat_ref != null) { if(ref == null) ref = nat_ref; else ref += ; + nat_ref; } - String reg_ref = element.getTag(reg_ref); + String reg_ref = Label.squashSpaces(element.getTag(reg_ref)); if(reg_ref != null) { if(ref == null) ref = reg_ref; @@ -577,13 +578,13 @@ public class StyledConverter implements OsmConverter { } private void elementSetup(MapElement ms, GType gt, Element element) { - String name = element.getName(); + String name = Label.squashSpaces(element.getName()); String refs = combineRefs(element); // Insert display_name as first ref. // This causes display_name to be displayed in routing // directions, instead of only the ref. - String displayName = element.getTag(display_name); + String displayName = Label.squashSpaces(element.getTag(display_name)); if (displayName != null) { // substitute '/' for ';' in display_name to avoid it ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Commit: r1621: Add --min-line-size and --min-polygon-size options.
Hello Felix, Could it be that the new for polygons 8 is much much bigger compared to the old (using patch) 8??? Or that the patch was not enacted on resolution 24?? Err, why? Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Commit: r1621: Add --min-line-size and --min-polygon-size options.
Felix, Or that the patch was not enacted on resolution 24?? Yes, that's true and looking at the code, I think that for polygons it probably should always be done and, furthermore, should be done after the polygon splitting so that any tiny polygons produced by the splitting get removed. i.e. it should look like this, perhaps: diff --git a/src/uk/me/parabola/mkgmap/build/MapBuilder.java b/src/uk/me/parabola/mkgmap/build/MapBuilder.java index c2593c6..28098ee 100644 --- a/src/uk/me/parabola/mkgmap/build/MapBuilder.java +++ b/src/uk/me/parabola/mkgmap/build/MapBuilder.java @@ -930,13 +930,13 @@ public class MapBuilder implements Configurable { if (enableLineCleanFilters (res 24)) { filters.addFilter(new PreserveHorizontalAndVerticalLinesFilter()); filters.addFilter(new RoundCoordsFilter()); - filters.addFilter(new SizeFilter(minPolygonSize)); //DouglasPeucker behaves at the moment not really optimal at low zooms, but acceptable. //Is there an similar algorithm for polygons? if(reducePointError 0) filters.addFilter(new DouglasPeuckerFilter(reducePointError)); } filters.addFilter(new PolygonSplitterFilter()); + filters.addFilter(new SizeFilter(minPolygonSize)); filters.addFilter(new RemoveEmpty()); filters.addFilter(new ShapeAddFilter(div, map)); ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Commit: r1620: Can now explicitly tag boundary nodes with mkgmap:on-boundary=1.
Hi Garvan, Can now explicitly tag boundary nodes with mkgmap:on-boundary=1. Apologies for the beginners question, but how do I use this? In the OSM source like this? node id= -1 lat=11.00 lon=103.72 tag k = mkgmap:on-boundary=1 / /node I am assuming this is to allow us to mark external nodes that connect to external nodes in other tiles - is this correct? This would be fun to experiment with, splitting tiles in gpsmapedit, converting them to osm format and then compiling. It's me that should apologise for committing that addition with no explanation. It explicitly says that a given point is a boundary node. Of course, it only makes sense to do that for routable ways. Boundary nodes are normally created automatically when a routable way is clipped at the tile's boundary. This lets you create a boundary node anywhere. It's used like this: tag k='mkgmap:on-boundary' v='1' / So, you were nearly right. Mark ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Re: [mkgmap-dev] Generate coastline - can we keep the coastline way?
On Wed, 24 Mar 2010 14:33:15 + Toby Speight t.m.speight...@cantab.net wrote: When --generate-coastline=multipolygon fails, I'm left with a map that has no distinction between land and sea. However, if I don't use --generate-coastline, I at least get a line (from my style/lines). Is there any good reason why generating coastline prevents the line rules from being applied to the coastline ways? It's not a problem when I actually get sea tiles, but it's a serious nuisance when small islands have completely disappeared! ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev Perhaps this does what you want? diff --git a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java index 0b150ef..8d40da2 100644 --- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java +++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java @@ -531,8 +531,9 @@ public class Osm5XmlHandler extends DefaultHandler { String natural = currentWay.getTag(natural); if(natural != null) { if(coastline.equals(natural)) { - currentWay.deleteTag(natural); - shoreline.add(currentWay); + Way w = currentWay.copy(); + w.deleteTag(natural); + shoreline.add(w); } else if(natural.contains(;)) { // cope with compound tag value @@ -547,10 +548,11 @@ public class Osm5XmlHandler extends DefaultHandler { others += ; + n; } if(foundCoastline) { - currentWay.deleteTag(natural); + Way w = currentWay.copy(); + w.deleteTag(natural); if(others != null) - currentWay.addTag(natural, others); - shoreline.add(currentWay); + w.addTag(natural, others); + shoreline.add(w); } } } ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev