Re: [mkgmap-dev] Multipolygons and disappearing coastlines

2009-12-27 Thread WanMil

 Hi Chris,

 Mark Burton schrieb:

 So, is putting the coastline into a multipolygon a reasonable OSM
 thing?

 A coastline is often also a boundary and boundaries are
 multipolygons in OSM.

 If so, should mkgmap be breaking the coastline by removing its
 tags? If not, how do we fix that?

 My guess is, that the multipolygon handling in mkgmap is not working
 perfectly.

 See an older thread on this list where I suggest a
 workaround. (I check if the MP has no inner elements
 and change the type=multipolygon to type=boundarypolygon
 if this is the case).

 Chris

 OK, that's understood.

 But why do we have to trash the original ways when we make a
 multipolygon from them? Would it not be better to give the relation a
 duplicate of the way to trash so that the original way can go on to
 serve its original purpose. Perhaps we should do this:

 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 acc5cf9..fbb1d57 100644
 --- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
 +++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
 @@ -266,10 +266,12 @@ class Osm5XmlHandler extends DefaultHandler {
  private void startInRelation(String qName, Attributes attributes) {
  if (qName.equals(member)) {
  long id = idVal(attributes.getValue(ref));
 -   Element el;
 +   Element el = null;
  String type = attributes.getValue(type);
 -   if (way.equals(type)){
 -   el = wayMap.get(id);
 +   if (way.equals(type)) {
 +   Way way = wayMap.get(id);
 +   if(way != null)
 +   el = way.duplicate();
  } else if (node.equals(type)) {
  el = nodeMap.get(id);
  if(el == null) {

 I just tried this patch and (just like magic) the coastline reappears.

 Cheers,

 Mark

Hi Mark,

I didn't try your patch but the idea is good. It is also more compliant 
to the rules described in the OSM wiki 
(http://wiki.openstreetmap.org/wiki/Multipolygon#Tagging) than the 
current implementation.

Mulitpolygon code should be reimplemented soon. As far as I am quite new 
to mkgmap I will need some time to do this.
At the moment I see the following things to do:

1. Only simple polygons are supported. Lots of options described in 
http://wiki.openstreetmap.org/wiki/Multipolygon#Advanced_multipolygons 
are not implemented. I think the algorithm in the OSM wiki 
(http://wiki.openstreetmap.org/wiki/Relation:multipolygon/Algorithm) is 
a good starting point to make mkgmap implementation compatible. Some 
rules about tagging are also described there.

2. The PolygonSplitter destroys the polygons created by the current 
multipolygon code. Up to now I do not fully understand if thats a 
problem or not. But I would feel better if someone could replace the 
usage of the java.awt.Area class with some code that does not remove the 
mulitpolygon connections between outer and inner rings.

3. Up to now the MultiPolygonRelation class does support one outer ring 
only. This must be changed so that the MultiPolygonRelation class can 
create multiple polygons in the garmin format. I do not fully understand 
how the Garmin map is assembled from the mkgmap map format, so any hint 
is appreciated.

WanMil

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


Re: [mkgmap-dev] Multipolygons and disappearing coastlines

2009-12-27 Thread Apollinaris Schoell
 
 
 2. The PolygonSplitter destroys the polygons created by the current 
 multipolygon code. Up to now I do not fully understand if thats a 
 problem or not. But I would feel better if someone could replace the 
 usage of the java.awt.Area class with some code that does not remove the 
 mulitpolygon connections between outer and inner rings.

yes this is a problem. polygons across multiple tiles are broken. It's not 
possible to close a polygon by a reliable algorithm. instead splitter should 
keep all members of a polygon and mkgmap can clip at tile boundary.
Have no Java knowledge but can provide a small example to demonstrate it.

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


[mkgmap-dev] Problem displaying mkgmap created maps with TTQV(Touratech Quo vadis)

2009-12-27 Thread Gert Münzel
Hi,
i have experienced( and also red that otherones maked the same 
experience) sometimes, that mkgmap created maps/overlays couldn't be 
displayed with TTQV althought the same map could be used with Mapsource 
perfectly.
Meanwhile accidently i created this possible erroneous map with a style 
from another of my maps  and amazingly then i could use it in TTQV. I'm 
shamed to say that i unfortunately forgot making a backup of the 
lines-file which seems to cause these kind of problem, so it's difficult 
for me going on investigating it.
May be some of you have an idea if there is compability issue by using 
style file entries with different mkgmaps versions which should be keep 
in mind by map builders.

Example which could not be displayed with TTQV
OSM Reit Wanderkarte
http://topo.geofabrik.de/OSM_Wanderkarte_mapsource.zip


cheers
Gert

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


Re: [mkgmap-dev] Problem displaying mkgmap created maps with TTQV(Touratech Quo vadis)

2009-12-27 Thread Felix Hartmann


On 27.12.2009 18:12, Gert Münzel wrote:
 Hi,
 i have experienced( and also red that otherones maked the same
 experience) sometimes, that mkgmap created maps/overlays couldn't be
 displayed with TTQV althought the same map could be used with Mapsource
 perfectly.
 Meanwhile accidently i created this possible erroneous map with a style
 from another of my maps  and amazingly then i could use it in TTQV. I'm
 shamed to say that i unfortunately forgot making a backup of the
 lines-file which seems to cause these kind of problem, so it's difficult
 for me going on investigating it.
 May be some of you have an idea if there is compability issue by using
 style file entries with different mkgmaps versions which should be keep
 in mind by map builders.

 Example which could not be displayed with TTQV
 OSM Reit Wanderkarte
 http://topo.geofabrik.de/OSM_Wanderkarte_mapsource.zip



Well that map is definitely not viewable under TTQV anyhow. It's style 
is unusable without .TYP-file and those TTQV does not support. If mkgmap 
default style would cause errors on TTQV import and this map is not 100% 
mkgmap, but created with a preprocessor on top, it really could be a bug 
inside mkmgap if maps created with default style are not viewable. Any 
maps containing multiple layers also wont be usable in TTQV, nor are 
3byte/extended types usable within TTQV and much much more.

The only other program besides Mapsource that reads more or less 
standard compliant (though no bitmaps allowed in .TYP-File) is gpsmapedit.
 cheers
 Gert

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


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


Re: [mkgmap-dev] Problem displaying mkgmap created maps with TTQV(Touratech Quo vadis)

2009-12-27 Thread Gert Münzel
Hi Felix,

i have just made a quick test using a simple map out of my tracks, 
mkgmap.jar V1442 and the default style of 1442
The resulting map can't be displayed in TTQV.
But if i used my own style i can display it.
cheers




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


[mkgmap-dev] Commit: r1443: Combine any gmapsupp files given as input into the output gmapsupp file correctly preserving family id's etc.

2009-12-27 Thread svn commit

Version 1443 was commited by steve on 2009-12-27 21:12:59 + (Sun, 27 Dec 
2009) 

Combine any gmapsupp files given as input into the output gmapsupp file 
correctly preserving family id's etc.
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] mkgmap dropping ways on multipolygon boundary outer

2009-12-27 Thread Felix Hartmann
Have a look here, wherever the boundaries use the same way as the ways, 
the ways get dropped, even if not rendering the boundaries at all 
(removing any reference to boundary from the style-file).

Is this maybe a geofabrik error, or some error in mkgmap multipolygon 
handling? I have noticed many (all that I checked) mkgmap maps suffer 
from missing roads in this example. (anyhow I don't render boundaries 
 admin_level=6)

http://www.openstreetmap.org/?lat=48.03113lon=16.88459zoom=16layers=B000FTF

Seems to be a bug in the Multipolygon Code.


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


Re: [mkgmap-dev] mkgmap dropping ways on multipolygon boundary outer

2009-12-27 Thread Mark Burton

Festive greetings Felix,

 Have a look here, wherever the boundaries use the same way as the ways, 
 the ways get dropped, even if not rendering the boundaries at all 
 (removing any reference to boundary from the style-file).
 
 Is this maybe a geofabrik error, or some error in mkgmap multipolygon 
 handling? I have noticed many (all that I checked) mkgmap maps suffer 
 from missing roads in this example. (anyhow I don't render boundaries 
  admin_level=6)
 
 http://www.openstreetmap.org/?lat=48.03113lon=16.88459zoom=16layers=B000FTF
 
 Seems to be a bug in the Multipolygon Code.

Perhaps it's the same issue as I mentioned yesterday (outer ways in
multipolygons are trashed by the process of generating the polygon). I
suggested that we should duplicate() the outer ways to preserve their
original use. As it stands, if a way is referenced in some multipolygon
its tags are wiped out so it will not work as the original author of
the way intended.

Cheers,

Mark

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 acc5cf9..fbb1d57 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
@@ -266,10 +266,12 @@ class Osm5XmlHandler extends DefaultHandler {
private void startInRelation(String qName, Attributes attributes) {
if (qName.equals(member)) {
long id = idVal(attributes.getValue(ref));
-   Element el;
+   Element el = null;
String type = attributes.getValue(type);
-   if (way.equals(type)){
-   el = wayMap.get(id);
+   if (way.equals(type)) {
+   Way way = wayMap.get(id);
+   if(way != null)
+   el = way.duplicate();
} else if (node.equals(type)) {
el = nodeMap.get(id);
if(el == null) {

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


Re: [mkgmap-dev] mkgmap dropping ways on multipolygon boundary outer

2009-12-27 Thread Felix Hartmann


On 27.12.2009 22:33, Mark Burton wrote:
 Festive greetings Felix,


 Have a look here, wherever the boundaries use the same way as the ways,
 the ways get dropped, even if not rendering the boundaries at all
 (removing any reference to boundary from the style-file).

 Is this maybe a geofabrik error, or some error in mkgmap multipolygon
 handling? I have noticed many (all that I checked) mkgmap maps suffer
 from missing roads in this example. (anyhow I don't render boundaries
   admin_level=6)

 http://www.openstreetmap.org/?lat=48.03113lon=16.88459zoom=16layers=B000FTF

 Seems to be a bug in the Multipolygon Code.
  
 Perhaps it's the same issue as I mentioned yesterday (outer ways in
 multipolygons are trashed by the process of generating the polygon). I
 suggested that we should duplicate() the outer ways to preserve their
 original use. As it stands, if a way is referenced in some multipolygon
 its tags are wiped out so it will not work as the original author of
 the way intended.

 Cheers,

 Mark

 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 acc5cf9..fbb1d57 100644
 --- a/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
 +++ b/src/uk/me/parabola/mkgmap/reader/osm/xml/Osm5XmlHandler.java
 @@ -266,10 +266,12 @@ class Osm5XmlHandler extends DefaultHandler {
  private void startInRelation(String qName, Attributes attributes) {
  if (qName.equals(member)) {
  long id = idVal(attributes.getValue(ref));
 -   Element el;
 +   Element el = null;
  String type = attributes.getValue(type);
 -   if (way.equals(type)){
 -   el = wayMap.get(id);
 +   if (way.equals(type)) {
 +   Way way = wayMap.get(id);
 +   if(way != null)
 +   el = way.duplicate();
  } else if (node.equals(type)) {
  el = nodeMap.get(id);
  if(el == null) {

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

Thanks for that patch... It does remove the bug, but all relations seem 
to get dropped by using this patch too. So not an ideal solution -:)

BTW before using this patch, relations like cycleroutes would even show 
up when all ways were dropped due to multipolygon outer...
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] mkgmap dropping ways on multipolygon boundary outer

2009-12-27 Thread Mark Burton

Felix,

 Thanks for that patch... It does remove the bug, but all relations seem 
 to get dropped by using this patch too. So not an ideal solution -:)
 
 BTW before using this patch, relations like cycleroutes would even show 
 up when all ways were dropped due to multipolygon outer...

OK - try this new version:

diff --git a/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java 
b/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
index e2f3c64..0ff5659 100644
--- a/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
+++ b/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
@@ -35,7 +35,7 @@ public class MultiPolygonRelation extends Relation {
String value = pairs.getValue();
 
if (value != null  pairs.getKey() instanceof Way) {
-   Way way = (Way) pairs.getKey();
+   Way way = ((Way)pairs.getKey()).duplicate();
if (value.equals(outer)){
outers.add(way);
} else if (value.equals(inner)){
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] mkgmap dropping ways on multipolygon boundary outer

2009-12-27 Thread Felix Hartmann


On 28.12.2009 00:04, Mark Burton wrote:
 Felix,


 Thanks for that patch... It does remove the bug, but all relations seem
 to get dropped by using this patch too. So not an ideal solution -:)

 BTW before using this patch, relations like cycleroutes would even show
 up when all ways were dropped due to multipolygon outer...
  
 OK - try this new version:

 diff --git a/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java 
 b/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
 index e2f3c64..0ff5659 100644
 --- a/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
 +++ b/src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
 @@ -35,7 +35,7 @@ public class MultiPolygonRelation extends Relation {
  String value = pairs.getValue();

  if (value != null  pairs.getKey() instanceof Way) {
 -   Way way = (Way) pairs.getKey();
 +   Way way = ((Way)pairs.getKey()).duplicate();
  if (value.equals(outer)){
  outers.add(way);
  } else if (value.equals(inner)){

Yip, that patch works great. (using only this patch, without the earlier 
patch; if I add earlier patch too I loose the relations again)
 ___
 mkgmap-dev mailing list
 mkgmap-dev@lists.mkgmap.org.uk
 http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

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