Selectors don't work for PostGIS layer
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?
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Will White on 05 Sep, 2011 09:19 PM
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
3 Posted by Rory on 05 Sep, 2011 09:40 PM
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.
Support Staff 4 Posted by Will White on 05 Sep, 2011 10:24 PM
Hi Rory,
Does it help if you remove the value from the "Unique Key Field" in the layer form?
Will
5 Posted by Rory on 05 Sep, 2011 10:35 PM
Yes! That solves it!
Support Staff 6 Posted by Will White on 05 Sep, 2011 10:39 PM
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
Support Staff 7 Posted by Dane on 06 Sep, 2011 01:44 PM
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.
Dane closed this discussion on 06 Sep, 2011 01:44 PM.