Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Selectors match where they shouldn't #315

Open
matthijsmelissen opened this issue Nov 12, 2013 · 9 comments
Open

Selectors match where they shouldn't #315

matthijsmelissen opened this issue Nov 12, 2013 · 9 comments
Labels
Milestone

Comments

@matthijsmelissen
Copy link

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.

@tmcw
Copy link
Contributor

tmcw commented Nov 12, 2013

By MapBox you mean TileMill, right? This is indeed a bug, and in Carto, due to testing for testname = two different values.

@matthijsmelissen
Copy link
Author

Thanks for your quick reply. Had anyone already created an issue for this?

@tmcw
Copy link
Contributor

tmcw commented Nov 12, 2013

Doesn't look like there's anything that hits exactly this, and you've given a good test case, thanks.

@matthijsmelissen
Copy link
Author

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 :).

@mrwojo
Copy link

mrwojo commented Dec 15, 2013

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".

@springmeyer
Copy link

I'm a bit confused here. What exactly is the bug that you each feel exists?

@matthijsmelissen
Copy link
Author

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.

@nebulon42
Copy link
Collaborator

nebulon42 commented Dec 13, 2016

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;
    }
  }
}

@nebulon42
Copy link
Collaborator

Will have to revert the fix for this as it causes performance problems.

nebulon42 added a commit that referenced this issue Jan 23, 2017
@nebulon42 nebulon42 modified the milestones: 0.18, 1.0 May 11, 2017
@nebulon42 nebulon42 modified the milestones: 1.0, 1.1 Dec 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants