You'll see the purpose of gridding, how to cross a vector and a raster layer in R. Finally we'll cover one of the latest functionnality of QGIS 2.12 : data-defined layer combinations in atlases.
If the world were square
|do you prefer ice creams or sandwiches ?|
|Matrix is the first movie approaching grids|
|hexagons look ecologic, triangles ecclesiastic|
Also, you could prefer hexagonal units to square units for more harmony. Some prefer triangles. Anyway, the number of possible shapes are limited.
Land Cover of Paris & surroundingsI wanted to visualize the land cover of Ile-De-France width a grid. Ile-de-France is a region that includes Paris at its center. Precisely, I decided to study the repartition of urban , agricultural and natural (forests, gardens, etc...) areas, that is 3 variables over the whole area.
|the best diagram I've ever made, even if pie charts are the worst|
The question was : how to represent 3 variables at a time on each square unit ? One answer could have been "diagrams", that is pie charts, histograms on the map
But I found it cooler to use an RGB representation.
|A Freemason way of seeing data|
|I remember a mushroom im my parents'garden had the same shape|
For the land cover of Ile-de-France, we have a nice 2012 Corine Land Cover GeoTiff.
|Laurent Manadou exploring data|
|beware of the logarithmic launching pad|
|The same sensation appears when you dive head first in a municipal pool|
Here is the video with land cover percentages encoded as colors, with reversed order, from the biggest to the smallest unit. The changing colors make it kind of animated dancefloor.
This illustration, that I had made for a GéoTribu post, illustrates the usual workflow I adopt, from production to design. I generated the distinct grids associated with the land cover percentage values with R. I designed all the layers with QGIS. With the same tool, I generated an atlas. With this atlas, I created a video with ffmpeg.
Technical detailsThe QGIS part may interest the QGIS fans as it uses a new QGIS 2.12 functionnality : data defined control over map layers and style presets
Generation : RI created a function in R that generates a grid. The hack consists in polygonizing a raster layer, of which the resolution determinates the square size :
The extract function crosses the vector grid and the 2012 CLC raster. The table function gives the number of pixels of each category :
The prop.table calculates the proportion of urban, natural and agricultural areas :
Design : QGIS
|color RGB code from columns, named "R", "G", and "B"|
|Data defined control over map layers and style presets|
Also, I used some generative design tricks to get the animated halo effect around the IDF region.
|Shapeburst fill and data-defined color|
The color follows the chromatic color circle, covering all the rainbow colors :
|riding the wave of generative design|
|sin wave shade distance|
while a sin function defines the shade distance. This way, we get a "flame" effect with increasing then decreasing shade width. scale_linear(sin(scale_linear(@atlas_featurenumber,1,100,0,pi()*2)),0,1,5,10)
Video making: ffmpegFinally, this command line generates the video from images :
ffmpeg -framerate 25 -r 10 -i output_%d.jpg -vcodec mpeg4 -b 50000k -qscale:v 1 dancingVideo.avi
The processing code
Images from The Noun Project : diver by Claire Jones, honey by Angela Horton, sandwich by Gareth Servant, biker by Les vieux garçons, ice cream by Rafaël Massé.