Re: [mkgmap-dev] errors in routing

2009-08-02 Thread garvan . maew
Quoting Mark Burton :

>
>> Should now be fixed.
>
> Err, that's only for OSM input.
>
> For Polish input it's not fixed - you have to fix your data instead.
> Just make sure that no road is longer than 25Km between nodes. If
> necessary, add extra nodes.
>
> I don't know what the distance constraint is here but with your sample
> data, I limited the length of the way to 25Km and the problem went
> away.
>
> Cheers,
>
> Mark

Thanks for your work on this, I will test it on the full map at lunch  
time or tonight. The problem is most evident when highways are added  
to otherwise blank sections of the map. I checked the entire map of  
the Netherlands yesterday to understand why others had not reported  
the problem and I found that all the road segments are short, so the  
problem did not show up.

I may be able to use mkgmap to fix my road data automatically in a  
once-off conversion, mp->osm->img->mp. I will need to check each step  
to make sure nothing is lost.

Garvan



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


Re: [mkgmap-dev] errors in routing

2009-08-02 Thread Mark Burton

> Should now be fixed.

Err, that's only for OSM input.

For Polish input it's not fixed - you have to fix your data instead.
Just make sure that no road is longer than 25Km between nodes. If
necessary, add extra nodes.

I don't know what the distance constraint is here but with your sample
data, I limited the length of the way to 25Km and the problem went
away.

Cheers,

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


Re: [mkgmap-dev] errors in routing

2009-08-02 Thread Mark Burton

Hi Garvan,

Should now be fixed.

Cheers,

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


[mkgmap-dev] Commit: r1117: Reduced MAX_ARC_LENGTH to avoid routing problem.

2009-08-02 Thread svn commit

Version 1117 was commited by markb on 2009-08-02 21:50:37 +0100 (Sun, 02 Aug 
2009) 

Reduced MAX_ARC_LENGTH to avoid routing problem.

With the previous value of 75000, routing could break even though RouteArc
was not actually complaining that the arc's length was too long to be
encoded.

So there must be some other constraint on an arc's length that we don't
know about.
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Magic highway symbols on Vista CX failing

2009-08-02 Thread Steve Ratcliffe
Hi

> I did not. If I do, the symbols appear correctly. I'm not familiar with
> neither the Garmin encoding nor mkgmap's handling of it, but would it be
> possible to add the codes for the symbols to the names in a way that
> they work with both 6bit and 8bit encoding?

Sure it just looks like a bug.  I've just commited a fix, try version 
r1116 and see if that is any better.

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


[mkgmap-dev] Commit: r1116: Fix the 6bit encoding of the highway shields.

2009-08-02 Thread svn commit

Version 1116 was commited by steve on 2009-08-02 20:15:11 +0100 (Sun, 02 Aug 
2009) 

Fix the 6bit encoding of the highway shields.
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


Re: [mkgmap-dev] Magic highway symbols on Vista CX failing

2009-08-02 Thread Alexander Wittig
Am 01.08.2009 5:09 Uhr schrieb Clinton Gladstone:
> On Jul 31, 2009, at 19:54, Alexander Wittig wrote
>> So I did some research and I think the problem is that not all of the
>> "magic" symbols in
>> src/uk/me/parabola/mkgmap/osmstyle/actions/HighwaySymbolFilter.java  
>> are
>> available on the unit. Also they are named wrongly for this unit.
>> 
>
> Just out of interest, have you tried using the  --latin1 option when  
> you compile your map?
>   

I did not. If I do, the symbols appear correctly. I'm not familiar with 
neither the Garmin encoding nor mkgmap's handling of it, but would it be 
possible to add the codes for the symbols to the names in a way that 
they work with both 6bit and 8bit encoding?

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


Re: [mkgmap-dev] [PATCH v2] sea polygons

2009-08-02 Thread Dermot McNally
2009/8/2 Christian Gawron :

> I can reproduce this problem and will have a look at it. My first guess
> is that either the shoreline is not closed or that there is still a
> problem with the multipolygon code.

Well, the coastline has been stable for a long time, so it _should_ be
closed, but we shouldn't deny the possibility. I'm thinking osmarender
would make it very visible if that were the problem, though...

Dermot

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


Re: [mkgmap-dev] [PATCH v2] sea polygons

2009-08-02 Thread Apollinaris Schoell
Christian,

thanks, this make perfect sense now. eager to test when you get the  
support for non-closed coastlines.

apo


On Aug 2, 2009, at 8:32 AM, Christian Gawron wrote:

> Dear Apollinaris,
>
> this is a misunderstanding.
>
> I use the relation internally:
> The code right now creates a relation with the sea as "outer" and the
> (closed) coastline segments as "inner" members. This way I don't  
> have to
> think about how to "punch the holes" into the sea.
> What is still missing is the handling of non-closed coastline  
> segments -
> these have to be added to the "outer" polygon.
>
> There is no need for a relation in the raw data.
>
> Best wishes
> Christian
>
> Apollinaris Schoell schrieb:
>> this is really great to get sea polygons. makes maps really much  
>> better
>> Don't understand why is there a need for relations?
>> is it common to have relations for coastline? have never seen it. my
>> understanding is the right side of the way is sea, left side is land.
>> how can the knowledge of inner way help here except in the case of an
>> island where you have the whole closed polygon available to make a
>> decision.
>> it's nearly impossible to build a relation for a whole continent. due
>> to restriction in relation members you would need parent relations
>> collecting all pieces. and when done all coastlines will be inner
>> elements. there can't be an outer element except you extend the
>> definition to leave earth
>>
>> ___
>> 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

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


Re: [mkgmap-dev] [PATCH v2] sea polygons

2009-08-02 Thread Christian Gawron
Dear Apollinaris,

this is a misunderstanding.

I use the relation internally:
The code right now creates a relation with the sea as "outer" and the 
(closed) coastline segments as "inner" members. This way I don't have to 
think about how to "punch the holes" into the sea.
What is still missing is the handling of non-closed coastline segments - 
these have to be added to the "outer" polygon.

There is no need for a relation in the raw data.

Best wishes
Christian

Apollinaris Schoell schrieb:
> this is really great to get sea polygons. makes maps really much better
> Don't understand why is there a need for relations?
> is it common to have relations for coastline? have never seen it. my  
> understanding is the right side of the way is sea, left side is land.  
> how can the knowledge of inner way help here except in the case of an  
> island where you have the whole closed polygon available to make a  
> decision.
> it's nearly impossible to build a relation for a whole continent. due  
> to restriction in relation members you would need parent relations  
> collecting all pieces. and when done all coastlines will be inner  
> elements. there can't be an outer element except you extend the  
> definition to leave earth
>   
> ___
> 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] [PATCH v2] sea polygons

2009-08-02 Thread Apollinaris Schoell
this is really great to get sea polygons. makes maps really much better
Don't understand why is there a need for relations?
is it common to have relations for coastline? have never seen it. my  
understanding is the right side of the way is sea, left side is land.  
how can the knowledge of inner way help here except in the case of an  
island where you have the whole closed polygon available to make a  
decision.
it's nearly impossible to build a relation for a whole continent. due  
to restriction in relation members you would need parent relations  
collecting all pieces. and when done all coastlines will be inner  
elements. there can't be an outer element except you extend the  
definition to leave earth



On Aug 2, 2009, at 2:32 AM, Christian Gawron wrote:

> This improved version should fix an OutOfMemoryError reported by  
> maning sambale and Dermot McNally.
> It also contains an update of the multipolygon patch by Rudi (which  
> seems to produce better results fo Corsica).
>
> Best wishes
> Christian
> Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
> ===
> --- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java 
> (Revision 1115)
> +++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java 
> (Arbeitskopie)
> @@ -1,11 +1,10 @@
> package uk.me.parabola.mkgmap.reader.osm;
>
> import java.util.ArrayList;
> -import java.util.Collection;
> +import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
>
> -import uk.me.parabola.imgfmt.Utils;
> import uk.me.parabola.imgfmt.app.Coord;
>
> /**
> @@ -16,15 +15,19 @@
>  */
> public class MultiPolygonRelation extends Relation {
>   private Way outer;
> - private final Collection inners = new ArrayList();
> + private List outers = new ArrayList();
> + private List inners = new ArrayList();
> + private Map myWayMap;
>
>   /**
>* Create an instance based on an exsiting relation.  We need to do
>* this because the type of the relation is not known until after all
>* its tags are read in.
>* @param other The relation to base this one on.
> +  * @param wayMap Map of all ways.
>*/
> - public MultiPolygonRelation(Relation other) {
> + public MultiPolygonRelation(Relation other, Map wayMap) {
> + myWayMap = wayMap;
>   setId(other.getId());
>   for (Map.Entry pairs: 
> other.getRoles().entrySet()){
>   addElement(pairs.getValue(), pairs.getKey());
> @@ -33,10 +36,12 @@
>
>   if (value != null && pairs.getKey() instanceof Way) {
>   Way way = (Way) pairs.getKey();
> - if (value.equals("outer"))
> - outer = way;
> - else if (value.equals("inner"))
> + if (value.equals("outer")){
> + outers.add(way);
> + }
> + else if (value.equals("inner")){
>   inners.add(way);
> + }
>   }
>   }
>
> @@ -45,18 +50,63 @@
>   }
>
>   /** Process the ways in this relation.
> +  * Joins way with the role "outer"
>* Adds ways with the role "inner" to the way with the role "outer"
>*/
>   public void processElements() {
> - if (outer != null)
> - {
> +
> + if (outers != null)
> + {
> + // copy first outer way
> + Iterator it = outers.iterator();
> + if (it.hasNext()){
> + // duplicate outer way and remove tags for 
> cascaded multipolygons
> + Way tempWay = it.next();
> + outer = new Way(-tempWay.getId());
> + outer.copyTags(tempWay);
> + for(Coord point: tempWay.getPoints()){
> + outer.addPoint(point);
> + }
> + myWayMap.put(outer.getId(), outer);
> + if (tempWay.getTags() != null){
> + tempWay.getTags().removeAll();
> + }
> + it.remove();
> + }
> + 
> + // if we have more than one outer way, we join them if 
> they are  
> parts of a long way
> + it = outers.iterator();
> + while (it.hasNext()){
> + Way tempWay = it.next();
> + if (tempWay.getPoints().get(0) == 
> outer.getPoints().get 
> (outer.getPoints().size()-1)){
> + 

Re: [mkgmap-dev] [PATCH v2] sea polygons

2009-08-02 Thread maning sambale
Here's my several attempts, same parameters with diiferent osm files:
time java -Xmx1512m -jar
/home/maning/osm/routable_garmin/mkgmap/trunk/dist/mkgmap.jar
--code-page=1252 --tdbfile --latin1 --country-abbr=PHI
--country-name=PHILIPPINES  --remove-short-arcs --route
--road-name-pois --add-pois-to-areas --location-autofill=2
--family-id=639 --family-name="OSM_PHIL" --overview-mapname=4001
--series-name="OSM_PHIL" --description="OSM_PHIL" --generate-sea
file.osm

1.  An osm file with incomplete coastline:
http://farm4.static.flickr.com/3445/3780035155_48128fb0a2.jpg

2.  OSM file for the whole philippines with splitter:
wrong sea polys along tile edges
http://farm4.static.flickr.com/3586/3780035733_0675c8bd6c.jpg
good sea areas on complete coastlines
http://farm4.static.flickr.com/3585/3780848642_ab4c987056.jpg

3. OSM file for the whole philippines no splitting:
http://farm4.static.flickr.com/3441/3780297907_450c021ed9.jpg


On Sun, Aug 2, 2009 at 8:41 PM, Christian Gawron wrote:
> Dermot McNally schrieb:
>> 2009/8/2 Christian Gawron :
>>
>>> This improved version should fix an OutOfMemoryError reported by maning
>>> sambale and Dermot McNally.
>>> It also contains an update of the multipolygon patch by Rudi (which seems to
>>> produce better results fo Corsica).
>>>
>>
>> OK... Again, based on the Geofabrik Ireland extract, this now runs to
>> completion - though very slowly. And indeed, I now have sea polygons
>> in the sea. The drawback is that I also have them on land, so it seems
>> like the coastline detection must be breaking down somewhere (Ireland
>> has a _very_ complex coastline in places).
>>
> I can reproduce this problem and will have a look at it. My first guess
> is that either the shoreline is not closed or that there is still a
> problem with the multipolygon code.
>
> Best wishes
> Christian
> ___
> 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] [PATCH v2] sea polygons

2009-08-02 Thread Christian Gawron
Dermot McNally schrieb:
> 2009/8/2 Christian Gawron :
>   
>> This improved version should fix an OutOfMemoryError reported by maning
>> sambale and Dermot McNally.
>> It also contains an update of the multipolygon patch by Rudi (which seems to
>> produce better results fo Corsica).
>> 
>
> OK... Again, based on the Geofabrik Ireland extract, this now runs to
> completion - though very slowly. And indeed, I now have sea polygons
> in the sea. The drawback is that I also have them on land, so it seems
> like the coastline detection must be breaking down somewhere (Ireland
> has a _very_ complex coastline in places).
>   
I can reproduce this problem and will have a look at it. My first guess 
is that either the shoreline is not closed or that there is still a 
problem with the multipolygon code.

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


Re: [mkgmap-dev] [PATCH v2] sea polygons

2009-08-02 Thread Dermot McNally
2009/8/2 Christian Gawron :
> This improved version should fix an OutOfMemoryError reported by maning
> sambale and Dermot McNally.
> It also contains an update of the multipolygon patch by Rudi (which seems to
> produce better results fo Corsica).

OK... Again, based on the Geofabrik Ireland extract, this now runs to
completion - though very slowly. And indeed, I now have sea polygons
in the sea. The drawback is that I also have them on land, so it seems
like the coastline detection must be breaking down somewhere (Ireland
has a _very_ complex coastline in places).

BTW, in my excitement to try out this functionality I forgot to do as
Clinton has done, to thank you for working on this. Having a blue sea
will improve my maps hugely.

Dermot

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


Re: [mkgmap-dev] Garmin Nuvi asks province

2009-08-02 Thread Charlie Ferrero
So is it there to address the "Find Interection" function on my GPS?

Mark Burton wrote:

> Enabling road name POIs does not help the address search function. It's
> a completely separate function. It was provided as a cheap hack to get
> some form of road name searching. Arguably, it works better than the
> address search which, as we know, is less than perfect.
> 
> 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 v1] sea polygons

2009-08-02 Thread Clinton Gladstone
On Aug 2, 2009, at 11:03, Christian Gawron wrote:

> The output suggests that the code repeatedly concatenates a (closed)  
> way
> with itself - this surely will exhaust the heap space quickly.
>
> I'will post an improved patch later.

Hi Christian,

I also received heap overflows similar to what was already reported by  
the others. But I think you can tell from the responses to your post  
that a number of people, myself included, are quite looking forward to  
having nice sea polygons in our maps.

Thanks for working on this!
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


[mkgmap-dev] [PATCH v2] sea polygons

2009-08-02 Thread Christian Gawron
This improved version should fix an OutOfMemoryError reported by maning 
sambale and Dermot McNally.
It also contains an update of the multipolygon patch by Rudi (which 
seems to produce better results fo Corsica).


Best wishes
Christian
Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
===
--- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java  
(Revision 1115)
+++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java  
(Arbeitskopie)
@@ -1,11 +1,10 @@
 package uk.me.parabola.mkgmap.reader.osm;
 
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import uk.me.parabola.imgfmt.Utils;
 import uk.me.parabola.imgfmt.app.Coord;
 
 /**
@@ -16,15 +15,19 @@
  */
 public class MultiPolygonRelation extends Relation {
private Way outer;
-   private final Collection inners = new ArrayList();
+   private List outers = new ArrayList();
+   private List inners = new ArrayList();
+   private Map myWayMap;
 
/**
 * Create an instance based on an exsiting relation.  We need to do
 * this because the type of the relation is not known until after all
 * its tags are read in.
 * @param other The relation to base this one on.
+* @param wayMap Map of all ways.
 */
-   public MultiPolygonRelation(Relation other) {
+   public MultiPolygonRelation(Relation other, Map wayMap) {
+   myWayMap = wayMap;
setId(other.getId());
for (Map.Entry pairs: 
other.getRoles().entrySet()){
addElement(pairs.getValue(), pairs.getKey());
@@ -33,10 +36,12 @@
 
if (value != null && pairs.getKey() instanceof Way) {
Way way = (Way) pairs.getKey();
-   if (value.equals("outer"))
-   outer = way;
-   else if (value.equals("inner"))
+   if (value.equals("outer")){
+   outers.add(way);
+   }
+   else if (value.equals("inner")){
inners.add(way);
+   }
}
}
 
@@ -45,18 +50,63 @@
}
 
/** Process the ways in this relation.
+* Joins way with the role "outer"
 * Adds ways with the role "inner" to the way with the role "outer"
 */
public void processElements() {
-   if (outer != null)
-   {   
+
+   if (outers != null)
+   {
+   // copy first outer way
+   Iterator it = outers.iterator();
+   if (it.hasNext()){
+   // duplicate outer way and remove tags for 
cascaded multipolygons
+   Way tempWay = it.next();
+   outer = new Way(-tempWay.getId());
+   outer.copyTags(tempWay);
+   for(Coord point: tempWay.getPoints()){
+   outer.addPoint(point);
+   }
+   myWayMap.put(outer.getId(), outer);
+   if (tempWay.getTags() != null){
+   tempWay.getTags().removeAll();
+   }
+   it.remove();
+   }
+   
+   // if we have more than one outer way, we join them if 
they are parts of a long way
+   it = outers.iterator();
+   while (it.hasNext()){
+   Way tempWay = it.next();
+   if (tempWay.getPoints().get(0) == 
outer.getPoints().get(outer.getPoints().size()-1)){
+   for(Coord point: tempWay.getPoints()){
+   outer.addPoint(point);
+   }
+   if (tempWay.getTags() != null){
+   tempWay.getTags().removeAll();
+   }
+   it.remove();
+   it = outers.iterator();
+   }
+   }
+   
for (Way w: inners) {   
-   if (w != null) {
-   List pts = w.getPoints();
-   int[] insert = 
findCpa(outer.getPoints(), pts);
-   

Re: [mkgmap-dev] [PATCH v1] sea polygons

2009-08-02 Thread Christian Gawron
Thanks for posting this!
The output suggests that the code repeatedly concatenates a (closed) way 
with itself - this surely will exhaust the heap space quickly.

I'will post an improved patch later.

Best wishes
Christian

maning sambale schrieb:
> 1 GB of heap size could not compile 62 MB osm file
>
> time java -Xmx1012m -jar
> /home/maning/osm/routable_garmin/mkgmap/trunk/dist/mkgmap.jar
> --code-page=1252 --tdbfile --latin1 --country-abbr=PHI
> --country-name=PHILIPPINES  --remove-short-arcs --route
> --road-name-pois --add-pois-to-areas --location-autofill=2
> --family-id=639 --family-name="OSM_PHIL" --overview-mapname=4001
> --series-name="OSM_PHIL" --description="OSM_PHIL" --generate-sea
> /home/maning/osm/routable_garmin/magellan/20090713/manila_20090713.osm
> generating sea
> merging: 33 4263797 33615705
> merging: 32 4591652 4591687
> merging: 31 4591978 33658311
> merging: 30 4592000 4611686018427387909
> merging: 29 4592029 4611686018427387908
> merging: 28 4598416 4598418
> merging: 27 23225661 23225148
> merging: 26 23959594 33050431
> merging: 25 27428886 32978387
> merging: 24 27635420 28340210
> merging: 23 28340457 4611686018427387916
> merging: 22 28538727 28538728
> merging: 21 31263118 4611686018427387918
> merging: 20 31390236 31390245
> merging: 19 33615706 33615707
> merging: 18 33615793 33658198
> merging: 17 33658197 4611686018427387907
> merging: 16 33677950 4611686018427387910
> merging: 15 4611686018427387912 4611686018427387912
> merging: 15 4611686018427387914 4611686018427387913
> merging: 14 4611686018427387915 4611686018427387926
> merging: 13 4611686018427387917 4611686018427387927
> merging: 12 4611686018427387919 4611686018427387928
> merging: 11 4611686018427387920 4611686018427387929
> merging: 10 4611686018427387921 33615708
> merging: 9 4611686018427387922 4611686018427387923
> merging: 8 4611686018427387925 4611686018427387925
> merging: 8 4611686018427387932 4611686018427387931
> merging: 7 4611686018427387933 4611686018427387933
> merging: 7 4611686018427387935 4611686018427387935
> merging: 7 4611686018427387936 4611686018427387936
> merging: 7 4611686018427387937 4611686018427387937
> merging: 7 4611686018427387938 4611686018427387938
> merging: 7 4611686018427387939 4611686018427387939
> merging: 7 4611686018427387940 4611686018427387940
> merging: 7 4611686018427387941 4611686018427387941
> merging: 7 4611686018427387942 4611686018427387942
> merging: 7 4611686018427387943 4611686018427387943
> merging: 7 4611686018427387944 4611686018427387944
> merging: 7 4611686018427387945 4611686018427387945
> merging: 7 4611686018427387946 4611686018427387946
> merging: 7 4611686018427387947 4611686018427387947
> merging: 7 4611686018427387948 4611686018427387948
> merging: 7 4611686018427387949 4611686018427387949
> merging: 7 4611686018427387950 4611686018427387950
> merging: 7 4611686018427387951 4611686018427387951
> merging: 7 4611686018427387952 4611686018427387952
> ^[[BSEVERE (Main): java.util.concurrent.ExecutionException:
> java.lang.OutOfMemoryError: Java heap space
> java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError:
> Java heap space
>   at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
>   at java.util.concurrent.FutureTask.get(FutureTask.java:111)
>   at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:289)
>   at 
> uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:124)
>   at uk.me.parabola.mkgmap.main.Main.main(Main.java:100)
> Caused by: java.lang.OutOfMemoryError: Java heap space
>   at java.util.Arrays.copyOf(Arrays.java:2772)
>   at java.util.Arrays.copyOf(Arrays.java:2746)
>   at java.util.ArrayList.ensureCapacity(ArrayList.java:187)
>   at java.util.ArrayList.addAll(ArrayList.java:499)
>   at 
> uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.concatenateWays(Osm5XmlHandler.java:838)
>   at 
> uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.generateSeaPolygon(Osm5XmlHandler.java:793)
>   at 
> uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.endDocument(Osm5XmlHandler.java:457)
>   at 
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:740)
>   at 
> com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.endDocument(XIncludeHandler.java:1122)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:491)
>   at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:810)
>   at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:740)
>   at 
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:110)
>   at 
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
>   at 
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$J

Re: [mkgmap-dev] [PATCH v1] sea polygons

2009-08-02 Thread Christian Gawron
Dermot McNally schrieb:
> This exhausted the 2G of heap space I had allocated when I tried it on
> a map of Ireland. Are there known practical limits I should try to
> stay within?
>
> Dermot
>   
I'm afraid the reason is the code which joins the shoreline segments. 
The code constructs a new way when two ways are joined (because the 
shoreline may be used in other relations, e.g. a state border). This may 
use large amounts of memory.

The obvious optimization is to create a new way only when "original" 
ways are joined. I will post an optimized patch later.

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


Re: [mkgmap-dev] [PATCH v1] sea polygons

2009-08-02 Thread maning sambale
1 GB of heap size could not compile 62 MB osm file

time java -Xmx1012m -jar
/home/maning/osm/routable_garmin/mkgmap/trunk/dist/mkgmap.jar
--code-page=1252 --tdbfile --latin1 --country-abbr=PHI
--country-name=PHILIPPINES  --remove-short-arcs --route
--road-name-pois --add-pois-to-areas --location-autofill=2
--family-id=639 --family-name="OSM_PHIL" --overview-mapname=4001
--series-name="OSM_PHIL" --description="OSM_PHIL" --generate-sea
/home/maning/osm/routable_garmin/magellan/20090713/manila_20090713.osm
generating sea
merging: 33 4263797 33615705
merging: 32 4591652 4591687
merging: 31 4591978 33658311
merging: 30 4592000 4611686018427387909
merging: 29 4592029 4611686018427387908
merging: 28 4598416 4598418
merging: 27 23225661 23225148
merging: 26 23959594 33050431
merging: 25 27428886 32978387
merging: 24 27635420 28340210
merging: 23 28340457 4611686018427387916
merging: 22 28538727 28538728
merging: 21 31263118 4611686018427387918
merging: 20 31390236 31390245
merging: 19 33615706 33615707
merging: 18 33615793 33658198
merging: 17 33658197 4611686018427387907
merging: 16 33677950 4611686018427387910
merging: 15 4611686018427387912 4611686018427387912
merging: 15 4611686018427387914 4611686018427387913
merging: 14 4611686018427387915 4611686018427387926
merging: 13 4611686018427387917 4611686018427387927
merging: 12 4611686018427387919 4611686018427387928
merging: 11 4611686018427387920 4611686018427387929
merging: 10 4611686018427387921 33615708
merging: 9 4611686018427387922 4611686018427387923
merging: 8 4611686018427387925 4611686018427387925
merging: 8 4611686018427387932 4611686018427387931
merging: 7 4611686018427387933 4611686018427387933
merging: 7 4611686018427387935 4611686018427387935
merging: 7 4611686018427387936 4611686018427387936
merging: 7 4611686018427387937 4611686018427387937
merging: 7 4611686018427387938 4611686018427387938
merging: 7 4611686018427387939 4611686018427387939
merging: 7 4611686018427387940 4611686018427387940
merging: 7 4611686018427387941 4611686018427387941
merging: 7 4611686018427387942 4611686018427387942
merging: 7 4611686018427387943 4611686018427387943
merging: 7 4611686018427387944 4611686018427387944
merging: 7 4611686018427387945 4611686018427387945
merging: 7 4611686018427387946 4611686018427387946
merging: 7 4611686018427387947 4611686018427387947
merging: 7 4611686018427387948 4611686018427387948
merging: 7 4611686018427387949 4611686018427387949
merging: 7 4611686018427387950 4611686018427387950
merging: 7 4611686018427387951 4611686018427387951
merging: 7 4611686018427387952 4611686018427387952
^[[BSEVERE (Main): java.util.concurrent.ExecutionException:
java.lang.OutOfMemoryError: Java heap space
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError:
Java heap space
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:289)
at 
uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:124)
at uk.me.parabola.mkgmap.main.Main.main(Main.java:100)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2772)
at java.util.Arrays.copyOf(Arrays.java:2746)
at java.util.ArrayList.ensureCapacity(ArrayList.java:187)
at java.util.ArrayList.addAll(ArrayList.java:499)
at 
uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.concatenateWays(Osm5XmlHandler.java:838)
at 
uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.generateSeaPolygon(Osm5XmlHandler.java:793)
at 
uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.endDocument(Osm5XmlHandler.java:457)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(AbstractSAXParser.java:740)
at 
com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.endDocument(XIncludeHandler.java:1122)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:491)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:810)
at 
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:740)
at 
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:110)
at 
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
at 
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:392)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
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

Re: [mkgmap-dev] [PATCH v1] sea polygons

2009-08-02 Thread Dermot McNally
This exhausted the 2G of heap space I had allocated when I tried it on
a map of Ireland. Are there known practical limits I should try to
stay within?

Dermot

2009/8/1 Christian Gawron :
> Hi,
>
> the attached patch adds a sea polygon  (based on the bounding box of the
> map) and a multipolygon relation with all lines tagged as natural=coastline
> as inner elements. The code merges coastline components as far as possible.
> The patch also contains the multipolygon patch by Rudi which wasn't commited
> so far (without this patch, the rendering fails).
>
> The sea polygon is created as "natural=sea", for which I added a mapping to
> garmin type 0x32.
>
> Caveat: I have only tested this for islands (Corsica) so far.
>
> Best wishes
> Christian
>
> Index: src/uk/me/parabola/mkgmap/reader/osm/Way.java
> ===
> --- src/uk/me/parabola/mkgmap/reader/osm/Way.java       (Revision 1115)
> +++ src/uk/me/parabola/mkgmap/reader/osm/Way.java       (Arbeitskopie)
> @@ -76,6 +76,10 @@
>                }
>        }
>
> +        public boolean isClosed() {
> +           return points.get(0).equals(points.get(points.size()-1));
> +        }
> +
>        /**
>         * A simple representation of this way.
>         * @return A string with the name and start point
> Index: src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
> ===
> --- src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
>  (Revision 1115)
> +++ src/uk/me/parabola/mkgmap/reader/osm/MultiPolygonRelation.java
>  (Arbeitskopie)
> @@ -5,7 +5,6 @@
>  import java.util.List;
>  import java.util.Map;
>
> -import uk.me.parabola.imgfmt.Utils;
>  import uk.me.parabola.imgfmt.app.Coord;
>
>  /**
> @@ -23,8 +22,9 @@
>         * this because the type of the relation is not known until after all
>         * its tags are read in.
>         * @param other The relation to base this one on.
> +        * @param wayMap Map of all ways.
>         */
> -       public MultiPolygonRelation(Relation other) {
> +       public MultiPolygonRelation(Relation other, Map wayMap) {
>                setId(other.getId());
>                for (Map.Entry pairs:
> other.getRoles().entrySet()){
>                        addElement(pairs.getValue(), pairs.getKey());
> @@ -33,8 +33,16 @@
>
>                        if (value != null && pairs.getKey() instanceof Way) {
>                                Way way = (Way) pairs.getKey();
> -                               if (value.equals("outer"))
> -                                       outer = way;
> +                               if (value.equals("outer")){
> +                                       // duplicate outer way and remove
> tags for cascaded multipolygons
> +                                       outer = new Way(-way.getId());
> +                                       outer.copyTags(way);
> +                                       for(Coord point: way.getPoints())
> +                                               outer.addPoint(point);
> +                                       wayMap.put(outer.getId(), outer);
> +                                       if (way.getTags() != null)
> +                                               way.getTags().removeAll();
> +                               }
>                                else if (value.equals("inner"))
>                                        inners.add(way);
>                        }
> @@ -52,11 +60,20 @@
>                {
>                        for (Way w: inners) {
>                                if (w != null) {
> -                                       List pts = w.getPoints();
> -                                       int[] insert =
> findCpa(outer.getPoints(), pts);
> -                                       if (insert[0] > 0)
> -                                               insertPoints(pts, insert[0],
> insert[1]);
> -                                       pts.clear();
> +                                       int[] insert =
> findCpa(outer.getPoints(), w.getPoints());
> +                                       //if (insert[0] > 0)
> +                                       insertPoints(w, insert[0],
> insert[1]);
> +
> +                                       // remove tags from inner way that
> are available in the outer way
> +                                       if (outer.getTags() != null){
> +                                               for (Map.Entry String> mapTags: outer.getTags().getKeyValues().entrySet()){
> +                                                       String key =
> mapTags.getKey();
> +                                                       String value =
> mapTags.getValue();
> +                                                       if (w.getTag(key) !=
> null)
> +                                                               if
> (w.getTag(key).equals(value))
> +
> w.deleteTag(key);
> +