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

Weird behaviour with attachment and multiple selectors #284

Closed
yohanboniface opened this issue Jul 2, 2013 · 8 comments
Closed

Weird behaviour with attachment and multiple selectors #284

yohanboniface opened this issue Jul 2, 2013 · 8 comments

Comments

@yohanboniface
Copy link
Contributor

@springmeyer here is what I think is the smallest use case of the behaviour exposed on IRC today.

project.mml:

{
  "bounds": [
    -72.2653,
    19.5326,
    -71.7586,
    19.8133
  ],
  "center": [
    -72.1198,
    19.6698,
    16
  ],
  "format": "png",
  "interactivity": false,
  "minzoom": 0,
  "maxzoom": 20,
  "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
  "Stylesheet": [
    "roads.mss"
  ],
  "Layer": [
    {
      "Datasource": {
        "dbname": "hdm",
        "geometry_field": "way",
        "host": "",
        "id": "roads_high",
        "key_field": "",
        "password": "",
        "port": "5432",
        "project": "hdm",
        "srs": null,
        "table": "( SELECT way, name, highway AS type, CASE WHEN highway='primary' THEN 'bar' ELSE 'baz' END AS foo FROM planet_osm_line WHERE highway IS NOT NULL ORDER BY layer, z_order) AS data",
        "type": "postgis",
        "extent": "-20037508,-19929239,20037508,19929239",
        "user": "ybon"
      },
      "class": "",
      "geometry": "linestring",
      "extent": [
        -179.99999692067183,
        -84.96651228427099,
        179.99999692067183,
        84.96651228427098
      ],
      "id": "roads_high",
      "name": "roads_high",
      "srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
      "srs-name": "900913",
      "advanced": {
        "extent_from_subquery": "true"
      }
    }
  ],
  "scale": 1,
  "metatile": 2,
  "attribution": "Data © OpenStreetMap (and) contributors, CC-BY-SA",
  "description": "",
  "name": "hdm"
}

roads.mss:

#roads_high::outline {
  [type='primary'] {
    line-color: blue;
  }
    [foo='bar'] { line-width: 15; }
}

#roads_high {
  [type='primary'] {
    line-color: red;
  }
    [foo='bar'] { line-width: 10; }
}

Then if you have a psql database with the default osm2pgsql import you will be able to run it.

Here is what I have (only the highway=primary are rendered):

screenshot from 2013-07-02 23 53 14

The casing is black, but I expect it to be blue.
If I move the line-width in the [type=primary] selector in any of the main selectors, the problem disappears.

Mapnik version: 2.2.0
Carto version: 0.9.4
Running head of TileMill: mapbox/tilemill@7874cce3d82e70239f44f09a0aab1f49f62bef8f

@yohanboniface
Copy link
Contributor Author

Note: if I try running with carto 0.9.3, I fall into #283

@yohanboniface
Copy link
Contributor Author

And as expected, if I install carto from cfc90da (before #247 fix) I have the expected behaviour. So I will run this for now, in order to generate the MBTiles.

@springmeyer
Copy link

thanks, nice testcase. I have replicated very different behavior between 6eda91a (the parent of the known breakage of #247 in 4d4abb2) and master. Will add a failing test shortly. Hoping this will help @tmcw fix.

@springmeyer
Copy link

okay, stepping through commits and running this new test reveals that this regressed in 4203578. So, this problem is new and only appeared when we attempted to fix #247 in master.

@yohanboniface
Copy link
Contributor Author

@springmeyer @tmcw just thinking: what about changing the trunk version in something like "0.9.5-dev" ("0.9.5-alpha", or whatever is more semverish)? I've been first trapped here because the working instance and the bugged one were both saying to run the "0.9.4" carto version.

@tmcw
Copy link
Contributor

tmcw commented Jul 3, 2013

I'd rather not: git tags and npm releases constitute tagged releases, everything else is a snapshot and you should ignore the version number until it's pushed/tagged.

@springmeyer
Copy link

I'm traveling/offline for the remainder of this week, but keen to work with @tmcw early next week to solve this bug.

@springmeyer
Copy link

fixed in bbeff81 thanks to @tmcw.

Now we need more tests to ensure we avoid any future regressions, please see: #245

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants