0

One of my layers (a postgis query from my local osm2pgsql database) is being translated incorrectly in Tilemill.

The query is attempting to select the way, the area of the polygon, and the sport=* tag as follows:

( SELECT way, sport AS sport, way_area AS area, COALESCE(leisure, "natural", highway, amenity, tourism) AS type
  FROM planet_osm_polygon
  ORDER BY way_area DESC
) AS data

This query works as expected in pgadmin and returns the results that I expect.

In my project.mml file, this layer is represented as follows:

{ "Datasource": { "dbname": "cleveosm2pgsql", "extent": "-20037508.34 -20037508.34 20037508.34 20037508.34", "geometry_field": "way", "host": "localhost", "id": "landuse", "key_field": "", "port": "5432", "project": "osm-bright-imposm", "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", "table": "( SELECT way, sport, way_area AS area, COALESCE(leisure, \"natural\", highway, amenity, tourism) AS type\n FROM planet_osm_polygon\n ORDER BY way_area DESC\n) AS data", "type": "postgis", "user": "skors" }, "class": "", "geometry": "polygon", "id": "landuse", "name": "landuse", "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", "status": "on", "advanced": {} },

When I open my project in Tilemill, I receive the following error:

Postgis Plugin: ERROR: column "sport" does not exist LINE 1: SELECT ST_AsBinary("way") AS geom,"sport","type" FROM ( SELE... ^

in executeQuery Full sql was: 'SELECT ST_AsBinary("way") AS geom,"sport","type" FROM ( SELECT way, way_area AS area, COALESCE(landuse, leisure, "natural", highway, amenity, tourism) AS type FROM planet_osm_polygon WHERE way_area > 10000 ORDER BY way_area DESC ) AS data WHERE "way" && ST_SetSRID('BOX3D(-9089279.907446878 4999593.14607681,-9030576.269723864 5058296.783799823)'::box3d, 900913)'

I have already cleared my cache (within the layer's menu in tilemill) and restarted tilemill. Any Idea why Tilemill is modifying my query to change the sport column from sport to "sport"?

1 Answer 1

0

The error message in tilemill was actually from a different layer whose query and name was extremely similar to the one listed in my project.mml.

A relatively simple mistake. Note that the error includes "WHERE way_area > 10000 " which was not in my query and and tipped off Dane from MapBox that they were in fact 2 different layers.

I fixed the problem by simply adding the sport column to the other layer's query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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