1

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_width and 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

0
2

You might need to switch to Mapnik 2.1.0 if you want to use this style. See https://github.com/mapnik/mapnik/wiki/PostGIS#other-tokens.

At this point the size of a way relative to the pixel is calculated, and the way will get dropped if it is too small. See also https://github.com/mapbox/osm-bright/issues/72 for a suggestion on the OSM Bright style, and how it can be substituted.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.