The Github repository containing the CartoCSS styling for the OpenStreetMaps dataset also defines queries for the different layers (see this file).
An example of such a query is
SELECT way, "natural", waterway, landuse, name, way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels FROM planet_osm_polygon WHERE (waterway IN ('dock', 'riverbank', 'canal') OR landuse IN ('reservoir', 'basin') OR "natural" IN ('water', 'glacier')) AND building IS NULL AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real ORDER BY z_order, way_area DESC
Running this query against my local database fails with
ERROR: column "pixel_width" does not exist LINE 7: way_area/NULLIF(!pixel_width!::real*!pixel_heigh...
as error message. This is on Ubuntu where
psql --version outputs
psql (PostgreSQL) 9.3.10
Anybody has any idea what those
pixel_height values are, and what I need to do with my local PostGIS database to run those queries ? The steps on the OpenStreetMap Wiki do not list anything special.
The closest match I found is the
ST_PixelWidth function but this is for rasters, and the syntax used in the examples does not match the syntax used in OSM. So it is obviously not that