I've just got a slippy map set-up using Mapnik to render OpenStreetMap data.
I've loaded SRTM elevation data following the PostGIS steps here and can now see contour lines on the map.
I'm trying to customise the contour line styling. Excuse my poor graphics skills in the following image, I thought it may be easier to use to communicate what I am trying to achieve.
I'm trying to style the contour lines in a way that the uphill edge of all the lines have a different colour from the downhill edge (in the above image red to indicate downhill and pink to indicate uphill).
I'm not sure what's the best way or if it's even possible to do using Mapnik styling but I thought of the following possibible options:
- Render a line then create a duplicate by calculating the centre of the lines circle, and then reduce or increase the ratio by a pixel.
- Render one line and then style using a colour gradient at 90 degrees to the line
I think the first option could produce some varied results given that the contours are all different shapes and sizes. I suspect there could end up being too much of a gap between the two lines in some cases.
The second I think would create a more accurate contour as there will only be one line and hopefully reduce rendering time too. The main difficulty I see with this is how the Mapnik styling can differentiate between the uphill and downhill edge.