Selectors match where they shouldn't
Opened this issue · 9 comments
The following code renders all objects with line-width 1, even though I have neither a layer #somelayername, nor a field 'testname'.
#somelayername {
[testname = 'sometext'] {
[testname = 'alsosometext'] {
[zoom >= 1] {
line-width: 1;
}
}
}
}
I have tested this in MapboxTilemill with a small OSM fragment loaded in postgis, and a single postgis layer as follows:
"table": "(select way from planet_osm_line) as roads",.
Please let me know if this should actually be filed against MapboxTilemill or Mapnik.
By MapBox you mean TileMill, right? This is indeed a bug, and in Carto, due to testing for testname =
two different values.
Thanks for your quick reply. Had anyone already created an issue for this?
Doesn't look like there's anything that hits exactly this, and you've given a good test case, thanks.
I actually ran into this in practice, when working on the standard OSM style, and wanting to do something like this:
[feature = 'highway_motorway'],
[feature = 'highway_motorway_link'] {
/* code for any motorway */
[feature = 'highway_motorway_link'] {
/* code specific for links */
}
}
Would be nice if it could be fixed :).
This might already be fixed in carto. openstreetmap-carto's admin-01234 layer uses a similar pattern (abbreviated):
[admin_level = '2'],
[admin_level = '3'] {
[zoom >= 7] {
line-width: 2;
}
[zoom >= 10] {
[admin_level = '2'] {
line-width: 6;
}
On OSM.org, admin_level=2 at z10 renders at 6px as expected. However, in my TileMill install it renders at 2px.
My TileMill (which is the latest Windows release available) is using carto 0.4.7. It emits a LineSymbolizer with stroke-width="2". A newer carto (0.9.5) emits a LineSymbolizer with stroke-width="6".
The XML diff reveals a similar issue with national-park-boundaries text (abbreviated):
[way_area > 200000000][zoom >= 8][zoom < 12],
[zoom >= 11][zoom < 12] {
text-size: 8;
[zoom >= 11] { text-size: 11; }
}
My TileMill emits size="8" at zoom 11. In the latest carto it's size="11".
I'm a bit confused here. What exactly is the bug that you each feel exists?
I'm not sure if I understand what's unclear. The code I gave renders all objects with line-width 1, but I would expect it to have no effect as I have no layer #somelayername.
The sample in the first post still produces a style
rule where it shouldn't. Interestingly, this version works:
#somelayername {
[testname = 'sometext'] {
[zoom >= 1] {
line-width: 1;
}
}
}
Will have to revert the fix for this as it causes performance problems.