Wrong minzoom / maxzoom with -a 2.2.0 option
Nacktiv opened this issue · 9 comments
I am working with mapnik 2.2.0 and openstreetmap-carto-3.3.1. When I use carto 0.18.1
carto -a 2.2.0 project.mml > mapnik.xml
the result is (line 249)
<Layer name="world"
minzoom="750000"
srs="+proj=merc ...
Although there is no error I think the minzoom="750000" cannot be correct. With an older carto version (tilemill) in openstreetmap-carto-2.45.1 it is
<Layer name="world"
maxzoom="9"
srs="+proj=merc ...
I think the first example should be like this.
Without the -a 2.2.0 option it is
<Layer name="world"
minimum-scale-denominator="750000"
srs="+proj=merc ...
but mapnik 2.2.0 says unable to process that.
See also:
Interesting observation, thanks.
I'm not able to compile osm-carto 3.3.1 with the -a 2.2.0 option. Which is no surprise, because osm-carto 3.x is not compatible with Mapnik 2.x.
With osm-carto 2.45.1 I get the output you described.
I still think the output is correct. maxzoom=9
would mean that the feature is rendered from zoom level ~25 or so onwards. minzoom / minimum-scale-denominator=750000
means that the feature is rendered up to zoom level 9.
I always get confused by the zoom/scale-denominator switch between Mapnik 2 and 3. Maybe @springmeyer can help us out here?
Besides the values, do you notice anything odd in the rendering by Mapnik or didn't you look at that?
oops, sorry, I forgot to mention that: as far I can see only pull #2470 from sommerluk breaks compatibility with mapnik 2 and requires mapnik 3. This results in an error about unknown "margin" in placenames.mss only and has nothing to do with this topic. As a simple workaround I replaced placenames.mss with an older one (from openstreetmap-carto 2.45.1). Then carto compiles and the result in higher zoomlevels (15,16) is same as in the map on the openstreetmap website. I expect some difference in the positioning of placenames, but I didn't closely look at that.
Before writing this bugreport I didn't any tests with different zoomlevels, but I assumed that mapnik 2 expects a minzoom/maxzoom value in the range 0...25 since older carto versions (tilemill) write that. I don't know what mapnik 2 does with minzoom="750000"
. Does this prevent writing the layer at all?
I did same tests in openstreetmap-carto v2.45.1 with carto 0.18.1 with same result:
carto -a 2.2.0 project.mml > mapnik.xml
results in minzoom="750000"
carto project.mml > mapnik.xml
results in minimum-scale-denominator="750000"
I also got same results when renaming project.yaml to project.mml (carto refuses to do directly carto project.yaml > mapnik.xml)
Additionally I did some tests with lower zoomlevels. The mapnik.xml has the minzoom="750000"
in line 250. The rectangular region around München is the data I have loaded into the database and to avoid confusion: I experimented with colors, motorways are light blue.
I tried running carto 0.9.3 with openstreetmap-carto but had no luck. Too old for me.
If the images you posted refer to the output you get with minzoom=750000
then I see nothing wrong with that.
I don't know why you are seeing minzoom=9
with Tilemill but AFAIK Mapnik never used a zoom level value like that and always resorted to the scale denominator. That's why they renamed it with Mapnik 3, because it was confusing before (see #385).
But I'm no Mapnik developer, so you would have to wait for Dane.
If you could tell me again where you see a problem I'd be happy. :)
I don't question your stack choices, but out of curiosity: Why are you sticking with 2.2? It certainly makes things more complicated. Do you know Kosmtik? It comes with a recent carto version. Do you know that openstreetmap-carto recently got Docker images for development?
Ok, I begin to understand: in project.mml its written properties: maxzoom: 9
carto translates that to minimum-scale-denominator="750000"
for mapnik 3. The variable minimum-scale-denominator
is the same in mapnik 2 but is misnamed minzoom
there. Therefore carto translates to minzoom="750000"
for mapnik 2. I have no problems with that when you tell me that the minzoom="750000"
is correct.
See also #248 and this mapnik issue
But then tilemill doesn't work correctly which doesn't surprise me because it has more bugs. I had indeed problems in tilemill rendering low zoomlevels and this seems to be related to this topic. Styles which work in tilemill (like OSM-Bright) don't have properties...
in their stylesheet. When there is something like properties: maxzoom: 9
in your stylesheet, then tilemill will obviously use that like maximum-scale-denominator="9"
and you will never see it. I replaced that with "properties": {"minzoom": 750000 },
and that did it.
I use mapnik 2.2 because I am doing that in Windows 7 and had no luck in installing mapnik 3. Somewhere is said that Kosmtik will not install in Windows and it requires mapnik 3 anyway. Docker is quite new for me. Only Windows 10 supports the virtualization technology it uses. May be it can be added in Windows 7, but I prefer to do other things...
The variable minimum-scale-denominator is the same in mapnik 2 but is misnamed minzoom there.
That is correct.
But then tilemill doesn't work correctly which doesn't surprise me because it has more bugs.
I'm not sure. I also have used Tilemill once and it worked for me when working on osm-carto. It is a pity that it doesn't have a more recent version of carto.
Somewhere is said that Kosmtik will not install in Windows and it requires mapnik 3 anyway.
Yes, you are correct. This is both true for the last release and latest master. I just tried on a Windows 7 VM. I will do some work on the Kosmtik side to make that better. Kosmtik needs a upgrade to node-mapnik 3.6.2 and a new release on npm.
I'm not sure why you think that Mapnik 3 is a problem. For Kosmtik it is bundled as node-mapnik which offers pre-built binaries and so you should not have to install anything yourself here. (if it would work)
Regarding tilemill I have checked that. openstreetmap-carto 2.27 works in tilemill. This commit breaks tilemill compatibility. I didn't find any hint or comment why they did that. In 2.28 it will start with a water blue screen, because the world layer is blocked. Only at higher zoomlevels you will see something when you manage to find your data in the blue world. Unfortunately that was the version I started with in tilemill.
I am new to github. Would it be possible to fork 2.27 and add some of the later commits in order to make an tilemill compatible carto style?
Regarding mapnik 3 I finally managed to install it in Windows 7, but it was as odd as I assumed. It took me more than 1 full day to search binaries, dealing with errors, tracing dll's, jumping through paths. It would be nice when installing kosmtik would be easier.
Nice find. So Tilemill does not support minzoom and maxzoom in MML apparently. At least not with that particular version of carto. You could always try to upgrade the version of carto manually by doing npm install carto@x.y.z
in the directory where you installed Tilemill. You have to check if Tilemill still works with a newer version of carto, but in theory it should be possible.
minzoom
and maxzoom
were added to the MML to prevent unnecessary loading of layers by Mapnik because those layers don't render data out of the given zoom bounds. It is likely a performance improvement.