Selectors don't work for PostGIS layer

Rory McCann's Avatar

Rory McCann

04 Sep, 2011 01:16 PM

I have imported some OpenStreetMap data into PostGIS using osm2pgsql. I have added that postgis layer as a layer to TileMill, with the id #roads. I changed the carto style to include this simple selector:

#roads {
    line-width: 1;
}

And it works and I can see some roads on the map. If I add in a selector to that rule, e.g. I replace the above with this:

#roads[highway='trunk'] {
    line-width: 1;
}

and I get no roads showing up. If try other values of 'highway', e.g. primary, secondary, motorway, tertiary, unclassified, I see nothing. I get the same results (nothing) if I use double quotes (#roads[highway="roads"]). I enabled SQL query logging in postgresql, and the query includes "highway" column. Running that query in my own psql shell gives results with highway values. If I explore the #roads layer in TileMill, I see features with highway=trunk in the columns.

And yet, no roads show up. Is there something I'm forgetting to do? How can I get the roads to show up?

  1. Support Staff 2 Posted by Will White on 05 Sep, 2011 09:19 PM

    Will White's Avatar

    Hi Rory,
    I'm not able to reproduce this. This is the example project I cooked up:

    https://skitch.com/diggersf/fswms/tilemill

    Can you zip up your project directory and attach it here?

    Thanks,
    Will

  2. 3 Posted by Rory on 05 Sep, 2011 09:40 PM

    Rory's Avatar

    OK, here's the contents of /usr/share/mapbox/project/OSMIreland.

    This obviously doesn't include any PostgreSQL data, I dunno if it'd be helpful to have a few rows, so you can see if there is anything that catches your eye.

    While investigating this I tried using some of the Open Streets DC carto stylefiles. That file is still in the tarball, but obviously not used.

  3. Support Staff 4 Posted by Will White on 05 Sep, 2011 10:24 PM

    Will White's Avatar

    Hi Rory,
    Does it help if you remove the value from the "Unique Key Field" in the layer form?

    Will

  4. 5 Posted by Rory on 05 Sep, 2011 10:35 PM

    Rory's Avatar

    Yes! That solves it!

  5. Support Staff 6 Posted by Will White on 05 Sep, 2011 10:39 PM

    Will White's Avatar

    Ok, by removing that value, you may run into problems with any MBTiles exports if you use tooltips.

    This is a related issue: http://support.mapbox.com/discussions/tilestream/29-random-tooltips

  6. Support Staff 7 Posted by Dane on 06 Sep, 2011 01:44 PM

    Dane's Avatar

    This was a one liner bug upstream in mapnik, which is fixed now in trunk: http://trac.mapnik.org/changeset/3274. Thanks for this report Rory.

  7. Dane closed this discussion on 06 Sep, 2011 01:44 PM.

Comments are currently closed for this discussion. You can start a new one.

 

23 May, 2013 01:25 PM