[mkgmap-dev] map detects barriers like gate as passable by motor vehicle when it is only restricted to pedestrians

2010-03-18 Thread maning sambale
Hi,

Just want to share a report from one of the gps map users.

In this example, the gate blocks any motor vehicle from going to
grasshopper street and spider intersection, and to crispina. This gate
is only passable by pedestrian.
If the destination is somewhere crispina, the correct route should be
through caterpillar avenue and then left on spider street.

Here is a sample route with gate as barrier:
 
http://www.openstreetmap.org/?lat=14.44558lon=120.985888zoom=18layers=B000FTFT

The calculated route in roadtrip is here:
http://farm5.static.flickr.com/4059/4441971869_397ce8bd84_o.jpg


I'm inclined to think that this is a data problem (the gate should
explicitly define that is only usefule for pedestrians).  I can't find
the correct tagging for this one at the moment.  If such tag exist, is
it supported by mkgmap?



-- 
cheers,
maning
--
Freedom is still the most radical idea of all -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
--
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] turn restriction relations supported?

2010-03-18 Thread maning sambale
Hi,

Is this supported in mkgmap?
http://wiki.openstreetmap.org/wiki/Relation:restriction

What should be added in the relations style file?

-- 
cheers,
maning
--
Freedom is still the most radical idea of all -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
--
___
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

2010-03-18 Thread Marko Mäkelä
On Thu, Mar 18, 2010 at 02:06:12PM +0800, maning sambale wrote:
 I'm inclined to think that this is a data problem (the gate should
 explicitly define that is only usefule for pedestrians).  I can't find
 the correct tagging for this one at the moment.  If such tag exist, is
 it supported by mkgmap?

It is this gate, isn't it?
http://www.openstreetmap.org/browse/node/659516319
It has access=private, foot=yes.

Maybe mkgmap is being too liberal about the access=private (treating it like
access=yes), or its logic gets confused about the controversial access keys
(access=private would imply foot=private, which contradicts foot=yes).
What if you remove the access=private or add motorcar=no motorcycle=no?
(And while you are at it, add bicycle=yes or bicycle=no too, as appropriate.)

Marko
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] turn restriction relations supported?

2010-03-18 Thread Marko Mäkelä
Hi Maning,

 Is this supported in mkgmap?
 http://wiki.openstreetmap.org/wiki/Relation:restriction
 
 What should be added in the relations style file?

Just like multipolygons, it is handled by mkgmap directly, outside the styles.
It is supposed to just work, out of the box.  But note that the 'via' has to be
a node where the 'from' and 'to' ways are starting or ending.  (You have to 
split
the ways at the crossing.)  mkgmap does parse 'via' ways but will complain
that they will be ignored.

To see the RestrictionRelation warnings of mkgmap, you will have to enable
some logging:

java -Dlog.config=logging.properties -ea -jar mkgmap.jar ...

You can get a logging.properties file from http://www.polkupyoraily.net/osm/.

Best regards,

Marko
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] turn restriction relations supported?

2010-03-18 Thread maning sambale
Thanks!  I added this turn restriction for testing:
http://www.openstreetmap.org/browse/relation/453702

Will report back when map is compiled.

On Thu, Mar 18, 2010 at 3:10 PM, Marko Mäkelä marko.mak...@iki.fi wrote:
 Hi Maning,

 Is this supported in mkgmap?
 http://wiki.openstreetmap.org/wiki/Relation:restriction

 What should be added in the relations style file?

 Just like multipolygons, it is handled by mkgmap directly, outside the styles.
 It is supposed to just work, out of the box.  But note that the 'via' has to 
 be
 a node where the 'from' and 'to' ways are starting or ending.  (You have to 
 split
 the ways at the crossing.)  mkgmap does parse 'via' ways but will complain
 that they will be ignored.

 To see the RestrictionRelation warnings of mkgmap, you will have to enable
 some logging:

 java -Dlog.config=logging.properties -ea -jar mkgmap.jar ...

 You can get a logging.properties file from http://www.polkupyoraily.net/osm/.

 Best regards,

        Marko
 ___
 mkgmap-dev mailing list
 mkgmap-dev@lists.mkgmap.org.uk
 http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev




-- 
cheers,
maning
--
Freedom is still the most radical idea of all -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
--
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] turn restriction relations supported?

2010-03-18 Thread maning sambale
 To see the RestrictionRelation warnings of mkgmap, you will have to enable
 some logging:

 java -Dlog.config=logging.properties -ea -jar mkgmap.jar ...
Simple question, when the switch -ea is already in the mkgmap syntax
as above, you don't have to add the ea in the arguments.list file?

-- 
cheers,
maning
--
Freedom is still the most radical idea of all -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
--
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] error compiling the map

2010-03-18 Thread maning sambale
I got this error recently:
time java -Xmx1512m -jar mkgmap.jar --read-config=args.list philippines.osm
java.lang.NullPointerException
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.isIndexable(RuleFileReader.java:234)
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.isSolved(RuleFileReader.java:242)
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.isFinished(RuleFileReader.java:254)
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.rearrangeExpression(RuleFileReader.java:134)
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.saveRule(RuleFileReader.java:115)
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:94)
at 
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:70)
at 
uk.me.parabola.mkgmap.osmstyle.StyleImpl.readRules(StyleImpl.java:252)
at uk.me.parabola.mkgmap.osmstyle.StyleImpl.init(StyleImpl.java:138)
at 
uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.createStyler(Osm5MapDataSource.java:120)
at 
uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.load(Osm5MapDataSource.java:80)
at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:148)
at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:56)
at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:189)
at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:186)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)


my args.list
code-page=1252
ea
tdbfile
latin1
country-abbr=PHI
country-name=PHILIPPINES
remove-short-arcs=5
route
road-name-pois
add-pois-to-areas
family-id=639
family-name=OSM_PHIL
overview-mapname=4001
series-name=OSM_PHIL
description=OSM_PHIL
style-file=/home/maning/Downloads/osm/routable_garmin/svn/styles/osm-ph
generate-sea=polygons
index
adjust-turn-headings

mkgmap version 1598

-- 
cheers,
maning
--
Freedom is still the most radical idea of all -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
--
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v3] Multipolygon: Improved role handling

2010-03-18 Thread Marko Mäkelä
Hi WanMil,

 The messages are generated because the generate-sea algorithm
 generated two polygons with role=inner and one of these polygons
 lies inside the other. I don't know if that's a bug of the
 generate-sea code or if the OSM data has a problem.

I could imagine that there could be two lakes or two islands within each other,
without an island or lake in between.  Or perhaps there could legitimately be
several rings of nested islands and lakes, and generate-sea is not prepared
for that.

I summarized the warnings I get for finland.osm.bz2:

sed -e 's/^.* WARNING (\(.*\)):.*/\1/' mkgmap.log.0 |sort|uniq -c
 13 MapBuilder (highway has no region)
 68 MultiPolygonRelation
 73 RestrictionRelation (ignored unsupported tags or via ways)
887 RoadDef  (discarding extra label (already have 4))
  3 RouteNode (dead-end oneways, now suppressed by adding fixme=continue)

Now, let us see those MultiPolygonRelation warnings with generated IDs:

2010/03/18 08:59:59 WARNING (MultiPolygonRelation): 63240001.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/384611 contains 
errors.
2010/03/18 08:59:59 WARNING (MultiPolygonRelation): 63240001.osm.gz: Polygon 
4611686018427395994(14P : (51767205[14P]) carries role outer but lies inside an 
outer polygon. Potentially its role should be inner.

This one could be an error in the map data.  I do not understand what the
relation is about (something about snow coverage), and I am ignoring this one.
Last time I checked, there was a L-shaped unclosed line in the relation,
but now the error seems different.

2010/03/18 09:06:13 WARNING (MultiPolygonRelation): 63240002.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/405789 contains 
errors.
2010/03/18 09:06:13 WARNING (MultiPolygonRelation): 63240002.osm.gz: Polygon 
4611686018427450887(6P : (23545368[6P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

I guess that this is a tile-splitter problem.

2010/03/18 09:06:17 WARNING (MultiPolygonRelation): 63240002.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/406008 contains 
errors.
2010/03/18 09:06:17 WARNING (MultiPolygonRelation): 63240002.osm.gz: Polygon 
4611686018427452464(11P : (25662847[10P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

This one should be a Geofabrik problem (near the cutting polygon)

2010/03/18 09:07:13 WARNING (MultiPolygonRelation): 63240003.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/87598 contains errors.
2010/03/18 09:07:13 WARNING (MultiPolygonRelation): 63240003.osm.gz: Polygon 
4611686018427459670(5P : (31747976[5P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

Geofabrik problem.

2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/88837 contains errors.
2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
4611686018427482392(1P : (31828356[1P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

Geofabrik problem.

2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/253359 contains 
errors.
2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
4611686018427483191(10P : (40982083[10P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

Geofabrik problem.

2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/287119 contains 
errors.
2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
4611686018427483237(18P : (42303932[17P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.
2010/03/18 09:08:53 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
4611686018427483238(7P : (23446571[6P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

Geofabrik problem.

2010/03/18 09:08:55 WARNING (MultiPolygonRelation): 63240004.osm.gz: 
Multipolygon http://www.openstreetmap.org/browse/relation/301046 contains 
errors.
2010/03/18 09:08:55 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
4611686018427484412(7P : (43036113[6P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.
2010/03/18 09:08:55 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
4611686018427484414(8P : (43036115[7P]) carries role inner but is not inside 
any other polygon. Potentially it does not belong to this multipolygon.

Geofabrik problem.

Do you agree with my guess that these generated IDs 

Re: [mkgmap-dev] turn restriction relations supported?

2010-03-18 Thread charlie
maning sambale (emmanuel.samb...@gmail.com) wrote:

 To see the RestrictionRelation warnings of mkgmap, you will have to enable
 some logging:

 java -Dlog.config=logging.properties -ea -jar mkgmap.jar ...
 Simple question, when the switch -ea is already in the mkgmap syntax
 as above, you don't have to add the ea in the arguments.list file?

 --
Maning,

-ea is a java switch, not a mkgmap switch, so it should be invoked as  
written above.

Have a read of this: http://www.cferrero.net/maps/improve_OSM.html to  
learn more about logging.properties and using mkgmap to improve OSM  
data (including turn restrictions).

--
Charlie

___
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

2010-03-18 Thread Mark Burton

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) {
+

Re: [mkgmap-dev] [PATCH v3] Multipolygon: Improved role handling

2010-03-18 Thread WanMil

 2010/03/18 09:08:55 WARNING (MultiPolygonRelation): 63240004.osm.gz: 
 Multipolygon http://www.openstreetmap.org/browse/relation/301046 contains 
 errors.
 2010/03/18 09:08:55 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
 4611686018427484412(7P : (43036113[6P]) carries role inner but is not inside 
 any other polygon. Potentially it does not belong to this multipolygon.
 2010/03/18 09:08:55 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
 4611686018427484414(8P : (43036115[7P]) carries role inner but is not inside 
 any other polygon. Potentially it does not belong to this multipolygon.

 Geofabrik problem.

 Do you agree with my guess that these generated IDs must be coming from the
 multipolygons quoted immediately above them?

Yes that's true. A warning always consists of one line with the mp link 
and the further lines print out the specific warnings for this mp.


 Then, finally we have a mystery multipolygon where your patch did not
 seem to help to identify the source:

The mystery mp is generated by the generate-sea code and is the final 
sea multipolygon.


 2010/03/18 09:09:08 WARNING (MultiPolygonRelation): 63240004.osm.gz: 
 Multipolygon http://www.openstreetmap.org/browse/relation/4611686018427488909 
 contains errors.
 2010/03/18 09:09:08 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
 4611686018427489620(65P : (4614558[65P]) carries role inner but lies inside 
 an inner polygon. Potentially its role should be outer.
 2010/03/18 09:09:08 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
 4611686018427489967(18P : (42942687[18P]) carries role inner but lies inside 
 an inner polygon. Potentially its role should be outer.
 2010/03/18 09:09:08 WARNING (MultiPolygonRelation): 63240004.osm.gz: Polygon 
 4611686018427489992(28P : (52019072[28P]) carries role inner but lies inside 
 an inner polygon. Potentially its role should be outer.

 This would be in Northern Finland, most likely on the north tip of the Baltic 
 sea,
 near the Swedish border.  Let us see if my guess was right:

 http://www.openstreetmap.org/browse/way/4614558
 http://www.openstreetmap.org/browse/way/42942687
 http://www.openstreetmap.org/browse/way/52019072

 Right, all the objects are near Tornio/Haparanda, near the Finnish/Swedish
 border.  I fixed it in JOSM.  It seems that the natural=coastline has
 recently been changed to waterway=riverbank, but some islands were forgotten
 as natural=coastline, and one island was a duplicate polygon.  One island
 is natural=coastline bordered by waterway=riverbank and natural=coastline.
 I will move the waterway=riverbank a little further to the coast, just around
 the island.

 Thanks for your help!

   Marko

So we have to wait til tomorrow and then you can check if the 
generate-sea code will generate a full valid sea area without any 
flodding for finland? Wow, I hope that's working!

WanMil
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] [PATCH v3] Multipolygon: Improved role handling

2010-03-18 Thread Marko Mäkelä
Hi WanMil,

 So we have to wait til tomorrow and then you can check if the  
 generate-sea code will generate a full valid sea area without any  
 flodding for finland? Wow, I hope that's working!

I just checked the islands in Tornio/Haparanda, with today's dump, and  
I did not notice any flooding there. So, the warning was just a  
nuisance; mkgmap guessed right when eliminating the error.

Actually, the flooding is already gone since last week when I added a  
Perl filter that would strip the incomplete natural=coastline islands  
from the Geofabrik dump and move the endpoints of the mainland  
natural=coastline to the rectangular area borders. Yes, the sea will  
look weird, but I think it is good, because then nobody will assume to  
find any islands outside the Finnish border. Actually, it could be even  
better to make the sea polygon follow the Finnish territorial waters,  
because the Geofabrik dump would be missing most islands outside the  
border. But I guess someone who would navigate with OSM on the Baltic  
would not produce the map from a country extract.

My original plan was to download some coastlines separately and glue  
those to the Geofabrik dump with osmosis. But apparently it did not  
work as I expected, because generate-sea kept complaining. So I decided  
to do the Perl tweaking instead. It is much faster too. :-)

Marko
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Question to address search

2010-03-18 Thread WanMil
 Anyone else with knowledge of the file format is encouraged to join in!

 Steve


Hi Steve,

I have just started to have a look on the internals of the garmin 
fileformat. The wiki 
(http://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/Format) tells me 
that there are the formats
TRE
NOD
MDR
SRT
GMP
DEM

The documentation of the garmin-img sourceforge project also mentions 
the formats not yet documented in the wiki:
LBL
RGN
NET

I think LBL is the file in which the labels are stored in a non 
searchable format. And MDR contains the same information like LBL but it 
is searchable. Am I right?

It would be good if you can put your current knowledge to the wiki. 
Hopefully this will help to make progress to this long outstanding and 
highly demanded feature.

WanMil
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] [PATCH v2] - Code around highway shield crap when sorting labels

2010-03-18 Thread Mark Burton

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

2010-03-18 Thread Clinton Gladstone
On Mar 18, 2010, at 20:51, Felix Hartmann wrote:

 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?

Cheers.
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Broken Routes based on mkgmap map due to functional characters inside name

2010-03-18 Thread Mark Burton

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

2010-03-18 Thread Mark Burton

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

2010-03-18 Thread Clinton Gladstone
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?

Cheers.
___
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

2010-03-18 Thread Mark Burton

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

2010-03-18 Thread Mark Burton

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 

[mkgmap-dev] understanding mkgmap logs

2010-03-18 Thread maning sambale
Hi,

Thanks to charlie I activated logging in my map compilation and it
sure helps in fixing routing issues!  I already found  and fixed a few
oneways coming from nowhere

Several reports I don't understand:

2010/03/18 20:31:26 WARNING (StyledConverter): philippines.osm:
Motorway exit null
(http://www.openstreetmap.org/?mlat=7.07588mlon=125.62656zoom=17)
has no motorway! (either make the exit share a node with the motorway
or specify the motorway ref with a exit:road_ref tag)
2010/03/18 20:31:26 WARNING (StyledConverter): philippines.osm:
Motorway exit closed subdivision gate
(http://www.openstreetmap.org/?mlat=14.13477mlon=120.97857zoom=17)
has no motorway! (either make the exit share a node with the motorway
or specify the motorway ref with a exit:road_ref tag)

In my style I assigned barrier=gate as a highway exit: barrier=gate
[0x2001 resolution 24]

Full log is here:
http://dl.dropbox.com/u/607635/osm-ph_gps_maps/latest/mkgmap.log.0.txt

-- 
cheers,
maning
--
Freedom is still the most radical idea of all -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
--
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev