Detyler is a gem for downloading tile sets. Currently the only supported set is LINZ. It has support for using a cache, meaning it will only download tiles it does not have. Can output tiles either to a directory or as an mbtiles database.
Add this line to your application's Gemfile:
gem 'detyler'
And then execute:
$ bundle
Or install it yourself as:
$ gem install detyler
Please be aware of usage limits that tile sources may impose and stay within them.
A source is anything that responds to a tile(z, x, y)
message and returns the image data
require 'detyler'
detyler = Detyler::Job.new
linz_topo50_layer_id = "767"
detyler.source = Detyler::LINZSource.new("<your_api_key>", linz_topo50_layer_id)
detyler.store = Detyler::FileSystemStore.new(File.join("/Users/me/tile_cache/linz-tiles/", linz_topo50_layer_id))
w, s, e, n = 174.7474955, -41.3106508, 174.8015473, -41.2814872 # central Wellington, New Zealand
detyler.run([w, s, e, n], [12, 15])
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
- Clean up code: proper logging, etc
- Make creating the tile composites optional.
- Use oilypng rather than chunkypng
- Allow transforms of tiles as they are processed - provide a hook that lets you perform an operation on the tile data once it has been retrieved from the source and before it is saved.
- Move mbtiles into a separate gem
- Move tile/coordinate helpers into a separate gem?
- Generalise the web tile source
- Add option for multithreaded download of tiles
- LINZSource back off when 429 is hit
- Set User Agent when downloading
- https://boundingbox.klokantech.com/
- http://www.netzwolf.info/kartografie/osm/tilebrowser?lat=45&lon=-90&zoom=5
- http://tools.geofabrik.de/map/#0/47.9268/-2.1407&type=Geofabrik_Standard&grid=1&mlat=5.34718&mlon=31.25778
- http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
- Fork it ( https://github.com/ajesler/detyler/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request