Categories
data english Hacking

Open Street Map RL Wallpaper…

The final result
The final result

We wanted to paint one wall in our vestibule to add a little more color to the room. As we could not settle on a specific color, I thought of wallpaper. And is there any better theme than OpenStreetMap Data¹?

 
The theme was settled. It had to be a map, but which tiles? I thought of the beautiful pencil drawn MapBox tiles I saw some time ago:

OpenStreetMap Pencil Tiles by MapBox
OpenStreetMap Pencil Tiles by MapBox

We wanted some redish color so I had to convert the image with ImageMagick:

1
2
$ ./colorize.sh 25 file_in.png file_out.png
$ cat colorize.sh
#!/bin/bash
# I found this script in the imagemagick formus:
# http://www.imagemagick.org/discourse-server/viewtopic.php?t=17460#p91820
# It does about the same as gimp with the colorize option.
test -z $1 && exit -1

hue=$1
sat=50
light=0
hue=`convert xc: -format "%[fx:100*$hue/360]" info:`
sat=`convert xc: -format "%[fx:2*$sat]" info:`
test=`convert xc: -format "%[fx:$light<0?0:1]" info:`
light=`convert xc: -format "%[fx:abs($light)]" info:`
if [ $test -eq 0 ]; then
fillcolor="black"
else
fillcolor="white"
fi

convert \
$2 -set colorspace RGB -colorspace gray -set colorspace sRGB \
-fill "hsl($hue%,100%,50%)" -tint 40% \
-modulate 100,$sat,100 \
-fill $fillcolor -colorize $light% $3

the result is something like this:

MapBox's Pencil tiles colorized
MapBox’s Pencil tiles colorized

I crawled more™ tiles with the OpenstreetMap Bigmap script, but changed the source to MapBox’s servers for their pencil drawn tiles:

#!/usr/bin/perl

# generated from http://openstreetmap.gryph.de/bigmap.cgi/
# permalink for this map: http://openstreetmap.gryph.de/bigmap.cgi?xmin=71104&xmax=71231&ymin=45952&ymax=46143&zoom=17&scale=256&baseurl=http%3A%2F%2Ftile.openstreetmap.org%2F!z%2F!x%2F!y.png
#
use strict;
use LWP;
use GD;

my $img = GD::Image->new(32768, 49152, 1);
my $white = $img->colorAllocate(248,248,248);
$img->filledRectangle(0,0,32768,49152,$white);
my $ua = LWP::UserAgent->new();
$ua->env_proxy;
for (my $x=0;$x<128;$x++)
{
    for (my $y=0;$y<192;$y++)
    {
        my $xx = $x + 71104;
        my $yy = $y + 45952;
        # changed the path here:
        foreach my $base(split(/\|/, "https://c.tiles.mapbox.com/v3/examples.a4c252ab/17/!x/!y.png"))
	{
		my $url = $base;
                $url =~ s/!x/$xx/g;
                $url =~ s/!y/$yy/g;
		print STDERR "$url... ";
		my $resp = $ua->get($url);
		print STDERR $resp->status_line;
		print STDERR "\n";
		next unless $resp->is_success;
		my $tile = GD::Image->new($resp->content);
		next if ($tile->width == 1);
		if ($base =~ /seamark/) {
		my $black=$tile->colorClosest(0,0,0);
		$tile->transparent($black);
		}
		$img->copy($tile, $x*256,$y*256,0,0,256,256);
	}
    }
}
binmode STDOUT;
print $img->png();

Finally I had a 32,768 x 49,152 pixel PNG file with 324 MB. Scaling it the first time on my laptop took 8 hours. To colorize it the right way I found myself a machine with a little more ram. The final file was 20,110 x 35,000 pixels with a possible resolution of 340 dpi. It almost killed the windows machine at the copyshop but the results were really nice.

10 replies on “Open Street Map RL Wallpaper…”

A nice creative use of the ODbL licensed data from OpenStreetMap. Via Mapbox tile servers, which is stylish …and also avoids traffic on the ‘standard’ OSM tile server.

Its worth noting BigMap is not a very kind script to point at a tile server. It creates a burst of heavy traffic. One thing you can do, to be a little bit gentler on the server, is to stick “sleep(1);” in the middle of the loop. Slow it down.

The perl code in this blog is generated by the BigMap tool, and isn’t all that easy to customise the area directly. Easier to go to BigMap and generate again for the area you’re interested in. …and then remember to swap to a different tile server.

I created a custom version of the script, which might’ve been a bit of a problem for the main OSM tile server, but hopefully not. I added sleep commands and made it skip ocean tiles to try to be kind. Lots of modifications in this script here:
http://harrywood.dev.openstreetmap.org/christchurch/bigmapmod.pl

thanks for that.

The wallpaper itself reduces the traffic on the tile servers even more 😉 although updates are harder to come by 😛

Very interesting!

I have to redocorate a room in our flat too and this is a very nice idea. Could you tell me a little bit more about how you printed it, which paper you used (what papersize did you print it on?) and how to actually put that on the wall? I have a lot of experience with paperhanging, but always used normal wallpaper, not something self-printed.

Hi Klaus!

I did not do the printing myself. The copyshop helped me pick the paper. They had a previous client that used the same paper for decoration in a restaurant.
The paper has a flat surface in the front and a roughened surface on the backside.
I just put the wallpaper up with normal wallpaper glue aka wheatpaste (in german: Tapeten-Kleister). That worked perfectly.

I hope this helps.
Florian

Mappbox using tokens for the tiles. So it´s not possible to get these tiles… 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

verify you\'re human: * Time limit is exhausted. Please reload CAPTCHA.