blob: 905aedb890cb65ba7bfa27ff260cfe16ea9d324c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# This script will create tiles of different zoom levels.
target_dir = "./tiles"
min_zoom = 1
max_zoom = 5
min_zoom.upto(max_zoom) do |z|
`rm -rf #{target_dir}/#{z}`
# Create the required directories.
0.upto(2**z-1) do |x|
`mkdir -p #{target_dir}/#{z}/#{x}`
end
# Render the raster graphics using Inkscape.
puts "Rendering zoom level #{z}..."
`inkscape -z -e /tmp/map-of-rc-#{z}.png -w #{256*2**z} -h #{256*2**z} sonnenstr58-v0.11.svg`
# Cut the raster graphics into tiles using ImageMagick.
`convert -density 1200 /tmp/map-of-rc-#{z}.png -crop 256x256 -set filename:tile "%[fx:page.x/256]/%[fx:page.y/256]" +repage +adjoin "#{target_dir}/#{z}/%[filename:tile].jpg"`
`rm /tmp/map-of-rc-#{z}.png`
end
|