You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
753 B

  1. # This script will create tiles of different zoom levels.
  2. target_dir = "./tiles"
  3. min_zoom = 1
  4. max_zoom = 5
  5. min_zoom.upto(max_zoom) do |z|
  6. `rm -rf #{target_dir}/#{z}`
  7. # Create the required directories.
  8. 0.upto(2**z-1) do |x|
  9. `mkdir -p #{target_dir}/#{z}/#{x}`
  10. end
  11. # Render the raster graphics using Inkscape.
  12. puts "Rendering zoom level #{z}..."
  13. `inkscape -z -e /tmp/map-of-rc-#{z}.png -w #{256*2**z} -h #{256*2**z} sonnenstr58-v0.11.svg`
  14. # Cut the raster graphics into tiles using ImageMagick.
  15. `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"`
  16. `rm /tmp/map-of-rc-#{z}.png`
  17. end