Dissolve polygons in R

Dissolving polygons is an elementary GIS task that I need to perform regularly. A dissolve removes internal boundaries, leaving only the outline. Packages Install and load the packages we’ll need. I use sf because it’s more intuitive than rgdal, and I’m loading tidyverse because it plays well with sf. # install.packages(c("tidyverse", "sf")) library("tidyverse") library("sf") Boundary data Download the shapefile we’re going to dissolve. tmp_dir = tempdir() tmp = tempfile(tmpdir = tmp_dir, fileext = ". [Read More]

Clip polygons in R

Clipping polygons is a common GIS task. For example, you might want to study local authorities (LADs) in the Yorkshire and the Humber region but can only obtain a shapefile with all the LADs in England. Removing all the LADs outside of the Yorkshire and the Humber can be achieved by ‘clipping’ the LADs, using the extent of the larger region as a template. HUGOMORE42 First, install and load sf for loading the shapefiles, and tidyverse for manipulating the data and plotting the maps. [Read More]
R  rstats  GIS  sf  clip  polygon-clip 

Set root directory for knitr

Knitr, by default, looks in the same directory as your .Rmd file to find any files you need to draw in, like data sets or script files. If you keep your data files and scripts in separate folders (and you should) you need to configure knitr.

[Read More]

Glossary and acronyms in LaTeX

To write a glossary in LaTeX you need to use a specific packages designed for the purpose. It then allows you to define a term and its acronym in a file, then reference the item later. The first time the item is referred to the full label and acronym are displayed automatically:

United Kingdom (UK)

All subsequent times you reference the item LaTeX just the acronym is shown:


[Read More]

Build large maps with OpenStreetMap

This is just a quick post to remind me to produce a full post later when I have more time. It’s surprisingly difficult to produce street maps in GIS for paper sizes bigger than about A2. Using QGIS for example, even if things look good in the print composer the resulting image often doesn’t have a background that extends to other layers. The solution is to use Atlas convergence. With OpenStreetMap as a background, create your map as normal in the print composer until it looks right. [Read More]