[OSM-dev] Generate complete slippy map (mapnik/generate_tiles.py)

Frederik Ramm frederik at remote.org
Fri Apr 11 15:09:04 BST 2008


Hi,

> Hang on - I doubt you've got enough disk space to do that. That's
> terabytes of space you'd need.

I have a neat little Perl script that tells you some details about the 
various zoom levels. These are *theoretical* values, I'd be interested 
to hear from operations. Here's the output (values are colon separated):

Zoom level:Tiles:Tiles cumul.:Bytes:Bytes cumul.:Tile width is:Pixel is
0:1 :1 :5 KB:5 KB:40075 km:157 km
1:4 :5 :20 KB:25 KB:20038 km:78 km
2:16 :21 :80 KB:105 KB:10019 km:39 km
3:64 :85 :320 KB:425 KB:5009 km:20 km
4:256 :341 :1 MB:2 MB:2505 km:10 km
5:1024 :1365 :5 MB:7 MB:1252 km:5 km
6:4096 :5461 :20 MB:27 MB:626 km:2 km
7:16384 :21845 :82 MB:109 MB:313 km:1222 m
8:65536 :87381 :328 MB:437 MB:157 km:611 m
9:262144 :349525 :1 GB:2 GB:78 km:305 m
10:1 million:1 million:5 GB:7 GB:39 km:152 m
11:4 million:6 million:21 GB:28 GB:20 km:76 m
12:17 million:22 million:84 GB:112 GB:10 km:38 m
13:67 million:89 million:336 GB:447 GB:5 km:19 m
14:268 million:358 million:1 TB:2 TB:2 km:9 m
15:1 billion:1 billion:5 TB:7 TB:1222 m:4 m
16:4 billion:6 billion:21 TB:29 TB:611 m:2 m
17:17 billion:23 billion:86 TB:115 TB:305 m:1 m
18:69 billion:92 billion:344 TB:458 TB:152 m:0 m

I.e. even if you only go down to zoom level 16, you should expect to 
store around 30 Terabytes of data.

The script is attached, for anyone who wants to tweak the assumptions 
(most notably the assumption that a tile has 5 kb on average).

Bye
Frederik

                   -------------------------
#!/usr/bin/perl

print "Zoom level:Tiles:Tiles cumul.:Bytes:Bytes cumul.:Tile width 
is:Pixel is\n";

# earth
$circum = 40075160;

# this number has the "70% water" figured in, i.e. of 100 possible
# tiles, only 30 will have non-water content, and if those average 16kb,
# then we have a total average of 5 kb per tile
$average_kb_per_tile = 5;

foreach my $zoom(0..18)
{
     print "$zoom:";
     $z=4**$zoom;
     $let="";
     if ($z>1000000) { $z=int(($z+500000)/1000000); $let = "million";
     if ($z>1000) { $z=int(($z+500)/1000); $let = "billion"; }}
     print "$z $let:";
     $kum += 4**$zoom;
     $z=$kum;
     $let="";
     if ($z>1000000) { $z=int(($z+500000)/1000000); $let = "million";
     if ($z>1000) { $z=int(($z+500)/1000); $let = "billion"; }}
     print "$z $let:";
     $mem = (4**$zoom)*$average_kb_per_tile;
     $kummem += $mem;
     $let = "KB";
     if ($mem>1000) { $mem=int(($mem+500)/1000); $let = "MB"; }
     if ($mem>1000) { $mem=int(($mem+500)/1000); $let = "GB"; }
     if ($mem>1000) { $mem=int(($mem+500)/1000); $let = "TB"; }
     print "$mem $let:";
     $let = "KB";
     $mem=$kummem;
     if ($mem>1000) { $mem=int(($mem+500)/1000); $let = "MB"; }
     if ($mem>1000) { $mem=int(($mem+500)/1000); $let = "GB"; }
     if ($mem>1000) { $mem=int(($mem+500)/1000); $let = "TB"; }
     print "$mem $let:";

     $cw = int($circum/(2**$zoom));
     $let="m";
     if ($cw>2000) { $cw=int(($cw+500)/1000); $let="km"; }
     print "$cw $let:";
     $cw = int($circum/(2**$zoom)/256);
     $let="m";
     if ($cw>2000) { $cw=int(($cw+500)/1000); $let="km"; }
     print "$cw $let\n";
}





More information about the dev mailing list