If you follow the instructions on installing Tilemill and toner-carto, only polyline piers will be in the database (mapped to table osm_roads with class='man_made').
For Tilemill, osm2pgsql
loads the OSM data extract into the database using the default.style
.
toner-carto
's Makefile employs imposm
with the included imposm3_mapping.json
to populate the database from the extract.
It maps "man_made:pier" to the class column, but there's also the filter
"filters": {
"exclude_tags": [
["area", "yes"]
]
},
So querying select * from osm_roads where class='man_made'
reveals Ways in my OSM extract that are not "area" but may be piers.
These are not rendered in Toner (hence this question).
But they can be easily added and queried (in Editor, the "Layers" icon is at the bottom left corner):
Adding a layer piers
with the above query and the style
#piers{
line-color: #ff0000;
line-width: 5;
}
finally shows an effect.
However, these are only open/closed Ways (Polyline), not Area (Polygon).
To get the Area piers into the database, I have extended imposm3_mapping.json
with a modified definition of roads
(keeping all fields for now since I don't know whether they are required):
"piers": {
"fields": [
{
"type": "id",
"name": "osm_id",
"key": null
},
{
"type": "geometry",
"name": "geometry",
"key": null
},
{
"type": "string",
"name": "highway",
"key": "highway"
},
{
"type": "string",
"name": "railway",
"key": "railway"
},
{
"type": "string",
"name": "name",
"key": "name"
},
{
"type": "boolint",
"name": "tunnel",
"key": "tunnel"
},
{
"type": "boolint",
"name": "bridge",
"key": "bridge"
},
{
"type": "direction",
"name": "oneway",
"key": "oneway"
},
{
"type": "string",
"name": "ref",
"key": "ref"
},
{
"type": "wayzorder",
"name": "z_order",
"key": "layer"
},
{
"type": "string",
"name": "access",
"key": "access"
},
{
"type": "string",
"name": "service",
"key": "service"
},
{
"type": "mapping_key",
"name": "class",
"key": null
}
],
"type": "polygon",
"mappings": {
"piers": {
"mapping": {
"man_made": [
"pier"
]
}
}
}
resulting in a osm_piers table which Tilemill can query as a piers layer with SELECT * FROM osm_piers
and style with
#piers{
polygon-fill: #ff0000;
}
So the next question is how to handle both types, "linestring" and "polygon".
It seems overly complicated to create a table for each, I suspect there is a better way.
On the other hand, they should be styled differently, otherwise open polylines would be filled incorrectly.
It's probably also possible to query these from planet_osm_ways directly, depending on the data extract import method.
Any comments on how to improve this are appreciated!