mapbox/carto

Option --api / Which mapnik versions are valid ?

Closed this issue · 3 comments

I have this:

$ carto --version
carto 0.17.2 (Carto map stylesheet compiler)

... and want to compile "osm-carto 3.3.0". But what I get is this:

$ carto --api '3.0' project.mml > mapnik.xml
carto: invalid Mapnik API version. A valid version is e.g. 3.0.10

$ carto --api '3.0.10' project.mml > mapnik.xml
Mapnik version 3.0.10 is not supported

Confusing ...

You get the first error when you specify a version that is not valid according to semver. Maybe this could be more explicit in the docs. I guess I should expand the example to A valid version is eg. 3.0.0 or 3.0.10.

You get the second error if mapnik-reference does not return a reference for this version. (see https://github.com/mapnik/mapnik-reference/blob/gh-pages/index._#L85) As mapnik-reference tries to find a satisfactory version for your input this should not happen often (see https://github.com/mapnik/mapnik-reference/blob/gh-pages/index._#L28). The latest API version of Mapnik is 3.0.6 but 3.0.10 should just return 3.0.6.

When I do a fresh install with npm install carto carto --api '3.0.10' project.mml > mapnik.xml works for me. But I might be missing something. How did you install carto?

Btw you should upgrade to 0.17.3 as it fixes a regression, but you don't hit it with osm-carto.

Thanks for looking into this ...

How did you install carto?

According to my installation notes I have done this (order is unclear):

sudo apt-get install node-carto
...
sudo npm install -g carto

The (double?) installation seems to be problem. After deinstalling node-carto ...

sudo apt-get autoremove node-carto
sudo apt-get clean node-carto

... and reinstalling carto ...

sudo npm install -g carto

... everything works fine for me (I'm able to build the destination xml file):

$ carto --version
carto 0.17.3 (Carto map stylesheet compiler)

$ carto --api '3.0.10' project.mml > mapnik.xml
Warning: using the name attribute for layers (like world here) is deprecated and will be removed in 1.0.0. Use id instead.
Warning: using the name attribute for layers (like coast-poly here) is deprecated and will be removed in 1.0.0. Use id instead.
Warning: using the name attribute for layers (like builtup here) is deprecated and will be removed in 1.0.0. Use id instead.
...

BTW: Why will the layer naming be removed in version 1.0.0? Mapnik has an option to hide layers (I use that) and a named layer is a valuable description. What exactly is the planned 'id'? Is it also descriptive?

Ok, fine.

Regarding name and id: Maybe the wording here again could be clearer. The naming will not be removed. Currently id and name are redundant and confusing. In the future only id will be used, which will then be passed to Mapnik as the name attribute. id was chosen because it is consistent with the CSS way of specifiying #someid { }.

#165 (comment) provides some more details.