[mkgmap-dev] Level number too large

2020-01-15 Thread Andrzej Popowski

Hi All,

since something is wrong with downloads on mkgmap site, I have compiled 
version 4419. I guess this is the latest official release. Now with some 
old maps I get a new error:


Error in style: Error: Level number too large, max=0

I guess this is a conflict between arguments:
levels=0:24

and style with declarations like:
 [... level 3]

In my opinion, this should be no error, as it wasn't in older versions 
of mkgmap. It is harmless and quite useful, that style defines higher 
levels then a particular map compiled with the style.


I have attached a patch, but I'm not sure what I'm really changing. 
Please look at it.


--
Best regards,
Andrzej

Index: src/uk/me/parabola/mkgmap/osmstyle/TypeReader.java
===
--- src/uk/me/parabola/mkgmap/osmstyle/TypeReader.java  (revision 4419)
+++ src/uk/me/parabola/mkgmap/osmstyle/TypeReader.java  (working copy)
@@ -245,7 +245,7 @@
private int toResolution(int level) {
int max = levels.length - 1;
if (level > max)
-   throw new SyntaxException("Level number too large, 
max=" + max);
+   return levels[0].getBits();
 
return levels[max - level].getBits();
}
___
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] Level number too large

2020-01-16 Thread Gerd Petermann
Hi Andrzej,

I am a bit confused.
If I got that right the check was introduced together with the levels option 
with r692 in the year 2008 and seems unchanged since then.
http://www.mkgmap.org.uk/websvn/diff.php?repname=mkgmap&path=%2Fbranches%2Fstyle%2Fsrc%2Fuk%2Fme%2Fparabola%2Fmkgmap%2Fosmstyle%2FTypeReader.java&rev=692&peg=692

On the other hand I see no problem with your patch, though I would use slightly 
different code, see my version.

Gerd


Von: mkgmap-dev  im Auftrag von Andrzej 
Popowski 
Gesendet: Mittwoch, 15. Januar 2020 21:41
An: mkgmap-dev@lists.mkgmap.org.uk
Betreff: [mkgmap-dev] Level number too large

Hi All,

since something is wrong with downloads on mkgmap site, I have compiled
version 4419. I guess this is the latest official release. Now with some
old maps I get a new error:

Error in style: Error: Level number too large, max=0

I guess this is a conflict between arguments:
levels=0:24

and style with declarations like:
 [... level 3]

In my opinion, this should be no error, as it wasn't in older versions
of mkgmap. It is harmless and quite useful, that style defines higher
levels then a particular map compiled with the style.

I have attached a patch, but I'm not sure what I'm really changing.
Please look at it.

--
Best regards,
Andrzej



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

Re: [mkgmap-dev] Level number too large

2020-01-16 Thread Andrzej Popowski

Hi Gerd,

probably some other changes made this error to appear. I have checked 
that v4323 compiles my map, while v4386 reports error.


I'm not sure about the purpose of the patched function, but I'm afraid 
there could be problems with following example:


options: levels=0:24,1:22
style:    [... level 2-3]

I don't know which part of code would be responsible for discarding an 
object with levels higher than maximum. If this is due to patched 
function, then maybe better would be something like:


if (level > max)
return levels[0].getBits() -1;


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


Re: [mkgmap-dev] Level number too large

2020-01-16 Thread Gerd Petermann
Hi Andrzej,

please double check. I get the same error when I use r4323 (as expected):
D:\mkgmap-4323>java -jar dist\mkgmap.jar --style-file=c:\mystyles\level 
f:\osm\dummy.osm
Time started: Thu Jan 16 16:11:26 CET 2020
Error in style: Error: Level number too large, max=0

Maybe you get a different error message? The only change in TypeReader since 
4223 was here:
http://www.mkgmap.org.uk/websvn/listing.php?repname=mkgmap&path=%2Fbranches%2FNET-no-NOD%2F&rev=4345#a7829a7e53a360b6e4dc93855915e8189

Gerd


Von: mkgmap-dev  im Auftrag von Andrzej 
Popowski 
Gesendet: Donnerstag, 16. Januar 2020 16:01
An: mkgmap-dev@lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] Level number too large

Hi Gerd,

probably some other changes made this error to appear. I have checked
that v4323 compiles my map, while v4386 reports error.

I'm not sure about the purpose of the patched function, but I'm afraid
there could be problems with following example:

options: levels=0:24,1:22
style:    [... level 2-3]

I don't know which part of code would be responsible for discarding an
object with levels higher than maximum. If this is due to patched
function, then maybe better would be something like:

if (level > max)
return levels[0].getBits() -1;


--
Best regards,
Andrzej
___
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] Level number too large

2020-01-16 Thread Andrzej Popowski

Hi Gerd,

tested again, the error really appeared somewhere after v4323. And I'm 
compiling the same map since 2014, this is the modification date on my 
scrips and style.


See for example this changelog:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=4345

Looks like changes include reading of levels from options - file StyleImpl.

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


Re: [mkgmap-dev] Level number too large

2020-01-16 Thread Gerd Petermann
Hi Andrzej,

yes, I posted a link to the same change. I tested this:
1) create copy of default style (r4323)
2) comment line overview-levels = 4:17, 5:16, 6:15, 7:14, 8:12
3) change line levels to levels = 0:24
4) add rule to polygons
landuse=land[0x02 level 3]

So, I assume you have a different way to set the levels option and that is 
causing the problem...

Gerd


Von: mkgmap-dev  im Auftrag von Andrzej 
Popowski 
Gesendet: Donnerstag, 16. Januar 2020 17:00
An: mkgmap-dev@lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] Level number too large

Hi Gerd,

tested again, the error really appeared somewhere after v4323. And I'm
compiling the same map since 2014, this is the modification date on my
scrips and style.

See for example this changelog:
http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=4345

Looks like changes include reading of levels from options - file StyleImpl.

--
Best regards,
Andrzej
___
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] Level number too large

2020-01-16 Thread Andrzej Popowski

Hi Gerd,

maybe the problem depends not only on levels. I have uploaded simplified 
version of a set for creating my map. You can examine, what is going on.


http://files.mkgmap.org.uk/detail/460

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


Re: [mkgmap-dev] Level number too large

2020-01-16 Thread Gerd Petermann
Hi Andrzej,

yes, the important change was in StyleImpl.java
With your options the old version read the style using the hard coded default 
levels "0:24, 1:22, 2:20, 3:18, 4:16"
With the new version the levels from the command line option is used instead.

It seems I did not expect that the options file in the style doesn't set 
levels. I'll try to find out if I can implement the wanted check in another way.

Gerd




Von: mkgmap-dev  im Auftrag von Andrzej 
Popowski 
Gesendet: Donnerstag, 16. Januar 2020 19:56
An: mkgmap-dev@lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] Level number too large

Hi Gerd,

maybe the problem depends not only on levels. I have uploaded simplified
version of a set for creating my map. You can examine, what is going on.

http://files.mkgmap.org.uk/detail/460

--
Best regards,
Andrzej
___
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] Level number too large

2020-01-16 Thread Andrzej Popowski

Hi Gerd,

thanks!

I never cared about levels in style, I have always used options.

My guess is, that levels doesn't need much control, only there should be 
foolproof conversion from levels to resolution. I expect, that objects 
defined with resolution are processed correctly.


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


Re: [mkgmap-dev] Level number too large

2020-01-16 Thread Andrzej Popowski

Hi Gerd,

just after expressing hope for good work of resolution, I got following 
error in r4420:


Error in style: Error: Cannot use type [0x2f17 resolution 24] with level 
0 at resolution 23 in style file points, line 270


It is again something, that I have used for a long time. My 
understanding is that object defined with "resolution 24" simply won't 
appear on level with resolution 23, regardless if it is level 0 or 1. 
Maybe you could change this error into a warning?


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