avatar tianjara.net | blog icon Andrew Harvey's Blog

A Mashup of Nearmap Shaded Relief Terrain Maps with OpenStreetMap Mapnik Tiles
28th October 2010

Some eye candy from my experiments of combining Nearmap terrain tiles with OpenStreetMap tiles. These images (which are hyperlinked to full sized ones) are derived works from OpenStreetMap.org default mapnik tiles (which is based on data from OpenStreetMap contributors licensed CC BY-SA 2.0), and Nearmap.com shaded relief terrain maps licensed under the Nearmap Community License.

[caption id="attachment_1198" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."]Nearmap Terrain Maps with OpenStreetMap Mapnik Map[/caption]

[caption id="attachment_1199" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."]Nearmap Terrain Maps with OpenStreetMap Mapnik Map.[/caption]

[caption id="attachment_1200" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."]Nearmap Terrain Maps with OpenStreetMap Mapnik Map.[/caption]

[caption id="attachment_1201" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."]Nearmap Terrain Maps with OpenStreetMap Mapnik Map.[/caption]

[caption id="attachment_1202" align="aligncenter" width="600" caption="Nearmap Terrain Maps with OpenStreetMap Mapnik Map. Based on images (c) OpenStreetMap contributors, CC-BY-SA, and (c) Nearmap, Nearmap Community License."]Nearmap Terrain Maps with OpenStreetMap Mapnik Map.[/caption]

My approach is based on http://wiki.openstreetmap.org/wiki/TopOSM/Details. I used two mapnik stylesheets, one for everything minus the labels, and one with just the labels. From here I used this bash script,

[sourcecode language="bash"] for f in nearmap-dem///* do f=echo $f|sed 's/[^\/]*\///' #get rid of the nearmap-dem part d=dirname $f mkdir -p "grayshaded/$d"

convert "nearmap-dem/$f" -colorspace gray "grayshaded/$f" #just convert to gray

...alternatively, extract the Lightness channel...

convert "nearmap-dem/$f" -separate -channel Lightness -colorspace gray "grayshaded/$f" lastdir=dirname "grayshaded/$f" lastfile=basename "grayshaded/$f" .png rm -f "$lastdir/$lastfile-0.png" "$lastdir/$lastfile-2.png" mv "$lastdir/$lastfile-1.png" "$lastdir/$lastfile.png" done [/sourcecode]

to convert a directory of Nearmap Terrain tiles into something suitable to be passed in as the hillshade layer to the combine script at http://wiki.openstreetmap.org/wiki/TopOSM/Details#Combining_images_into_a_final_composite, and then I used combine script to merge the layers together for each tile.

Update: The Mapnik stylesheets I used for labels and nolabels are at http://gist.github.com/653184

Tags: dev, nearmap, osm.