Features:
Announcing Raster Support for Simple Tiles
Live from SRCCON an update you want to know about
At ProPublica, we love maps. For the last few years we’ve been creating maps for projects like our investigations into gerrymandering and FEMA’s emergency maps. We’ve even dipped our toes into WebGL with our Hurricane Sandy flood visualization.
Many of these mapping projects rely on a software framework we wrote called Simple Tiles. To support the work we’re doing for a project launching this year that relies on satellite imagery, we’ve added raster-data support to the newest version of Simple Tiles.
“Raster data” refers to large images that are tied to coordinates on the earth. If you’ve ever used the satellite layer in Google Maps, or gazed at Mapbox Satellite, you’ve seen raster data.
We’ve been playing with this version of Simple Tiles internally for a couple of months now. We’re pretty happy with the results:
Rendering raster layers with Simpler Tiles — the Ruby bindings to Simple Tiles — only takes a small amount of code:
# Set up the tile url to capture x, y, z coordinates for slippy tile generation
get '/tiles/:x/:y/:z.png' do
# Let the browser know we are sending a png
content_type 'image/png'
# Create a Map object
map = SimplerTiles::Map.new do |m|
m.slippy params[:x].to_i, params[:y].to_i, params[:z].to_i
m.raster_layer "path/to/raster.tif"
end
map.to_png
end
You can read through the new code over on github. If you want to play around with the newest version read the installation instructions in the documentation. Please let us know in the issue tracker if you have problems, and help us improve the library by forking it.
Credits
-
Jeff Larson
Swell guy doing secret stuff. Formerly @propublica. Dad jokes. Email: thejefflarson@fastmail.com Public key: https://t.co/fT6H1SgtGT…