I am doing the #30DayMapChallenge with work colleagues Geoffrey and Kerry. I will only be doing every third day.
Would have liked to take data into R and do a bit of statistical analysis to see which, if any of these rates of blank ballots are significant.
There was an error in my earlier map (above).
The above map was made in QGIS while the one below was created in R. The problem with QGIS is that I didn’t track what calculations I did to create the values.
In R, the code is explicit and maintained, making a review or repair much easier. The lesson is, when possible, always do it in R if it’s anything other than pure cartography.
The map below shows that this is really not the best way to represent this type of data. See the Day 13 map for a better representation of similar data.
Blank and invalid ballots in Luxembourg’s October 2023 legislative election.
I wanted to do more with my Day 1 map… look at the statistics. I discovered an error in my methodology… need to fix Day 1 at some point.
Benefit of using R is reproducibility. Not exactly sure what I did wrong in Day 1 with QGIS.
Learned how to use the R package rayshader. Big install but impressive. Need a higher quality DEM next time.
Get a DEM/DSM for an area of interst.
In QGIS draw a line with rounded turns, such as through a valley. Use the Digitize with curve tool (Ctrl-Shift-G) for curves.
Import the scripts to the QGIS Processing Toolbox (PT) by clicking the Python icon in the PT and select “Add Script to Toolbox…”.
The use the script Perpendicular Line Creator (perpendicular_lines_creation.py) to generate a bunch of perpendicular lines at a specific interval (e.g. 10m) and length (e.g. 200.5m). The extra 0.5m is to prevent edge cases later.
Now have the DEM/DSM be sampled along the perpendicular lines and create a tab separated file. The script output needs some work but functions fine - just needs a bit of cleaning the output. I’ll fix it when I have time.
Use the Raster Profile Extractor (RSE) script (extract_profiles.py) provided.
Take the data into R, clean it up, and plot it.
You can also use RSE on satellite or aerial photography to sample the colour at the sampled locations.
Here are the alternatives possible based on whether you use a DSM, DTM, or orthophoto.
You can also use a simpler path - but it’s not quite the same. Here’s a line, rather than a curve, coming up the Bock (a rock formation in Luxembourg city).
Here’s my result,
And here along a DTM, without the buildings, trees, and other structures (except bridges!).
And here’s a hybrid between the two, showing the ‘ground’ (terrain) in white and highest surface (e.g., buildings, trees) in dark teal.