Crystal implementation of the Slippy Map Tilenames
https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
you can wrap this in a kemal project (or any other webservice / FaaS project) and use this for your tile based project 🔮 🚀
-
Add the dependency to your
shard.yml
:dependencies: slippy_tiles: github: simonneutert/slippy_tiles
-
Run
shards install
require "slippy_tiles"
# latitude, longitude, zoom
tile = SlippyTiles.get_tile_number(50.0, 8.0, 14)
puts tile[:x] #=> 8556
puts tile[:y] #=> 5556
# tile_x, tile_y, zoom
geo = SlippyTiles.get_lat_lng_for_number(8556, 5556, 14)
puts geo[:lat_deg].round #=> 50.0
puts geo[:lng_deg].round #=> 8.0
- Fork it (https://github.com/simonneutert/slippy_tiles/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
- Simon Neutert - creator and maintainer