-
Notifications
You must be signed in to change notification settings - Fork 129
Specificity and z-ordering #247
Comments
Explicit z-index feels correct to me here. The behavior of attachments is foreign to CSS, whose closest features are the |
Once you add z-index, it seems like you’d want to extend the Mapnik core to actually re-order features coming out of a datasource. You’ve already started mixing content & style, might as well follow through on the implications. This would require Carto to be a first-class replacement for the XML rather than a preprocessor. AJ’s reservations expressed in the comment on #237 largely come from the difficulty of expressing this all in XML, so it should be ditched. Sample use-case: buildings with z_order properties that can be rendered above or below nearby roads to faithfully represent case like overpass-covers-building vs. building-covers-tunnel, despite having two separate data layers. Anecdotally I’ve encountered bugs like #268 in Carto on a frequent basis, but that’s the first one I reported. I usually work around them by writing ~2x more Carto CSS than I would Cascadenik CSS and fix the problem by over-specifying. They feel like a result of mixing the attachment/instance concepts into a style language that’s not suited for expressing content edits or layer-level properties (e.g. #249), and the bugs emerge from the stresses placed on the underlying Layer/Style/Symbolizer/Feature loop. Search your feelings, you know it to be true. |
Thinking about this a little more (I’m on a train!) I see parallels with GL’s depth buffer, which performs depth sorting at the last possible moment before rendering to pixels. In my work on Python-based datasources, I’m finding that setting an attachment in Carto causes layer datasources to be evaluated twice, which in my case results in twice the network fetching overhead. Pulling all features from all Datasources could happen once, up-front, before looping through styles and symbolizers. Layers could provide one source of depth hint, just as element in order in HTML does, with z-index and attachment order providing another. |
This behavior looks like a regression in latest carto. I tracked this ticket down just now because I'm noticing this behavior for the first time in my actual usage. In TileMill 0.10.1 this css renders labels on top (as I would expect) while in the dev build of TileMill I'm testing with ( |
@springmeyer any luck maybe using git bisect to nail down the specific regression commit? |
Tom, I will tackle this but not tried to narrow down yet. Will do asap. On Apr 30, 2013, at 10:30 AM, Tom MacWright [email protected] wrote:
|
I've run into the same issue. Simple testcase that I've been using:
Uncomment the ne_10m_adm filter, and the order of attachments switches, from that revision onwards. |
awesome thanks for the help narrowing in @gravitystorm. Either Tom or I will try to track this down. I'm busy with Mapnik release atm, but this is on my mind. @gravitystorm - also, fyi: mapnik/mapnik#1859 |
I have confirmed the git bisect of @gravitystorm - this was definitely broken in 4d4abb2. I've added (currently failing) tests now that enforce the old behavior of style/attachment order than is independent to the # of rules in the style |
So, overall:
|
noticing that the openstreets-dc stylesheet is still not rendering correctly with latest carto/tilemill/mapnik - looks like like it did before this fix: #247 (comment) |
re-opening, not convinced this is fixed fully or that the problem is fully understood. |
these are the relevant changes between carto v0.9.3 and master: https://gist.github.com/springmeyer/5784466 Studying them now to try to reduce a testcase. |
Possibly related issue: #284 |
So attachment order is determined by definition order:
...unless one attachment has more 'specificity' than the other(s):
Two issues with this: it feels like unexpected behavior to the user, and the only way to work around it is by equaling out the specificity (which is hacky and not even always possible). I would love if specificity didn't work this way, but having an explicit z-index option (#237) would be workable.
Thoughts?
The text was updated successfully, but these errors were encountered: