Hello, I'm struggling to find info on how to generate maps with Mapnik (mml file) that only show the contour of states and counties for the US (for example), and everything else white or transparent. Any pointer welcome. Thanks! asked 07 Jul '21, 02:00 pat548 |
You have to set the background color of your map transparent, example in the xml: In the style.mss, replace the @land-color by rgba(0,0,255,0)
At the end, the <map>tag in the xml generated should look like something like this:
answered 11 Jul '21, 17:20 yvecai |
By contour do you mean height contours or just the administrative outlines?
I probably used the wrong word, I don't want height, just the country or state, or county, as a simple line, nothing else.
There is plenty of ways to achieve this. You should tell us a bit more about your goal, is it for a map on a website, is it for just a few counties, the all country? What have you tried so far?
I just want to generate a PNG, with transparency, for either the whole US, with states, or a single state with counties. So far, I've tried modifying the project.mml file of the openstreetmap-carto project to only show those lines, but even with a single layer, it still show the ocean and there's no transparency:
Layer: - id: landcover-line geometry: linestring <<: extents Datasource: <<: osm2pgsql table: |- (SELECT way FROM planet_osm_line WHERE man_made = 'cutline' ) AS landcover_line properties: minzoom: 5
I guess my main problem is I can't find any good documentation about all the options I can use here. I've looked into the reference, but without examples, it's hard to follow.
Correction, the layer is actually:
Layer: - id: admin-low-zoom geometry: linestring <<: extents Datasource: <<: osm2pgsql table: |- (SELECT way, admin_level FROM planet_osm_roads WHERE boundary = 'administrative' AND admin_level IN ('0', '1', '2', '3', '4') AND osm_id < 0 ORDER BY admin_level DESC ) AS admin_low_zoom properties: minzoom: 4 maxzoom: 7