Pandoc error parsing BibTeX file

I get the following error so often (and I always forget how to solve it) that I thought I’d post a solution.

pandoc-citeproc: "stdin" (line 2421, column 2):
unexpected "m"
expecting "c", "C", "p", "P", "s" or "S"
pandoc: Error running filter /usr/lib/rstudio/bin/pandoc/pandoc-citeproc
Filter returned error status 1
Error: pandoc document conversion failed with error 83

[Read More]

Geocoding with Google Geocoding API and Googleway

Geocoding is the process of taking an address, postcode, or other human–readable identifier and converting it into coordinates. Here I use the Google Geocoding API which I access within R with the googleway package. Obtain a Google Geocoding API key To use the Google Geocoding API service we need an API key: Open the Get API Key page Click Get Started When asked, you need to enable the Places product. [Read More]

Automate image layout for comparison

For a project I’m working on I needed to compare three figures each for about 50 countries. Printing 150 images seemed like a waste (especially as I would need to print the images single–sided) and open three images to view on screen 150 times was likely to result in me opening the wrong image at least once. My solution was to group the three images for each country onto one image for me to easily compare, and print if necessary.

[Read More]

Spatial packages and Travis

A number of R spatial libraries have been updated in the last couple of weeks, and this has played havoc with my Travis–CI build. I had still been using Ubuntu Trusty with Travis which uses old versions of libraries like rgdal and rgeos, so I needed to move to updated versions of these. In addition sf has now become a dependency for a number of spatial packages like tmap, and this uses libudunits2-dev which isn’t installed by default. [Read More]
sf  travis  rstats  gis 

Simplify polygons without creating slivers

When you download geographical data the polygons are often highly detailed, leading to large file sizes and slow processing times. This tutorials shows you how to simplify detailed polygons in R and QGIS without creating slivers (gaps) between the resultant shapes. When you download boundary data, for example from the census boundary data page, the polygons are usually highly detailed. Often this detail is unnecessary if you’re not intending to produce small–scale maps. [Read More]

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]