Category Archives: Blog Posts

Geocomputation and Analysis at the Essex Summer School

I’ve recently come back from the Essex Summer School, where I ran a two week course on Geocomputation and Analysis. I was really pleased with how the course ran, particularly as this was the first time I had run a course for this summer school. The summer school primarily is for social scientists (with its full title being Essex Summer School in Social Science Data Analysis) and my material had a range of social science examples in it. (You could argue that all GIS use is social science, because ultimately the questions we use GIS to answer have an impact on people, but that is probably a discussion for another time!)

I had a small group at the summer school, and this meant I could adapt the material to suit them. Many of them had political science backgrounds, so we spent some time creating cartograms of election results, similar to those produced by Benjamin Hennig and others, and summarised by Ken Field (aka Cartonerd). The standard cartograms proved relatively easy to create using ScrapeToad (which I have blogged on before, and will create a cartogram out of any shape file) but the hexagon cartograms proved more complex. I found a number of semi-useful webpages, but we struggled to produce anything sensible in the time available. We did also discover than Benjamin had released a KMZ version of the hexagons for his 2010 election map, which was a really useful starting point!

The brief course outline is on the Essex Summer School website, and a revised version of what I actually taught is also available (Word, .docx, 53KB). This is the first time the course was run, so I don’t yet know if it will run next year, but if you are interested, email me to join the mailing list!

Introduction to Using R for Spatial Analysis, 2nd Oct

A workshop on Introduction to Using R for Spatial Analysis is being run by the Geographic Data Science Lab and the Consumer Data Research Centre (CDRC) at the University of Liverpool.

Date: Friday 2nd October 2015, 9:30am – 4pm

Venue: Training Room 1, Sydney Jones Library, University of Liverpool, Liverpool.

Instructor: Dr Nick Bearman

Cost: £45 student, £80 HE / public sector, £200 commercial (see below for details)

This course will cover an introduction to R, how to load and manage spatial data and how to create maps using R. We will look at appropriate ways of using classifications for choropleth maps, using loops in R to create multiple maps and some basic spatial analysis. We will be using R Studio to work with the R environment. By the end of the course you will be able to load data into R, represent it effectively and be able to prepare an output quality map.

Experience of creating maps in ArcGIS, QGIS or similar is preferable, but not required. Experience of using R is not required. Please email Nick for more information. Refreshments and lunch are provided, and numbers on the course are limited and allocated on a first come, first served basis.

If you are not already familiar with the basic elements of GIS, you may wish to attend the course “Introduction to QGIS: Understanding and Presenting Spatial Data” instead where we build on basic GIS skills (more details).

Costs:

  • £45 – UK registered students
  • £80 – staff at UK academic institutions and research centres, UK-registered charity and voluntary organisations, staff in public sector and government
  • £200 – all other participants including staff from commercial organisations
    reduced prices are available for University of Liverpool affiliated students and staff cost negotiable for those less able to pay, please contact Nick Bearman for details

Registration:

Please register online. Please email n.bearman@liverpool.ac.uk if you need any more information.

Other Locations:

This course is also running in London in December (detail to follow). Please emailn.bearman@liverpool.ac.uk to be added to the mailing list to hear about future courses.

Location:

Information on getting to the University is available at:http://www.liv.ac.uk/maps/visiting/

A map of the campus is available at: http://www.liv.ac.uk/files/docs/maps/liverpool-university-campus-map.pdf

The Sydney Jones Library is building number 423 in grid F3 on the map.

Introduction to QGIS Understanding and Presenting Spatial Data, 1st Oct

A workshop on Introduction to QGIS: Understanding and Presenting Spatial Data is being run by the Geographic Data Science Lab and the Consumer Data Research Centre (CDRC) at the University of Liverpool.

Date: Thursday 1st October 2015, 9:30am – 4pm

Venue: Training Room 1, Sydney Jones Library, University of Liverpool

Instructor: Dr Nick Bearman

Cost: £45 student, £80 HE / public sector, £200 commercial (see below for details)

This course will introduce spatial data and show you how to import and display spatial data within the open source GIS program QGIS. We will also cover creating choropleth maps, some basic spatial data analysis (e.g. calculating rates) and appropriate methods of visualising spatial data. By the end of the course you will be able to load data into QGIS, symbolise it effectively and be able to prepare a publication quality map.

No previous experience of GIS or QGIS is required, but some experience of using spatial data will be beneficial. Please email Nick for more information. Refreshments and lunch are provided, and numbers on the course are limited and allocated on a first come, first served basis.

If you are already familiar with the basic elements of GIS, you may wish to attend the course “Introduction to Using R for Spatial Analysis” instead where focus on applying these GIS skills in R, and develop your spatial analysis skills (more details).

Costs:

  • £45 – UK registered students
  • £80 – staff at UK academic institutions and research centres, UK-registered charity and voluntary organisations, staff in public sector and government
  • £200 – all other participants including staff from commercial organisations
    reduced prices are available for University of Liverpool affiliated students and staff cost negotiable for those less able to pay, please contact Nick Bearman for details

Registration:

Please register online. Please email n.bearman@liverpool.ac.uk if you need any more information.

Location:

Information on getting to the University is available at:http://www.liv.ac.uk/maps/visiting/

A map of the campus is available at: http://www.liv.ac.uk/files/docs/maps/liverpool-university-campus-map.pdf

The Sydney Jones Library is building number 423 in grid F3 on the map.

Introduction to QGIS: Understanding and Presenting Spatial Data

Cross-posted from http://geographicdatascience.com/training%20course/2014/10/16/Introduction-to-QGIS/

A workshop on Introduction to QGIS: Understanding and Presenting Spatial Data is being run by the Geographic Data Science Lab at the University of Liverpool.

Date: Monday 17th November 2014, 9:30am – 4pm

Venue: Training Room 1, Sydney Jones Library, University of Liverpool

Instructor: Dr Nick Bearman

Cost: £30 student, £60 HE / public sector, £175 commercial (see below for details)

This course will introduce spatial data and show you how to import and display spatial data within the open source GIS program QGIS. We will also cover creating choropleth maps, some basic spatial data analysis (e.g. calculating rates) and appropriate methods of visualising spatial data. By the end of the course you will be able to load data into QGIS, symbolise it effectively and be able to prepare a publication quality map.

No previous experience of GIS or QGIS is required, but some experience of using spatial data will be beneficial. Refreshments and lunch are provided, and numbers on the course are limited and allocated on a first come, first served basis.

If you are already familiar with the basic elements of GIS, you may wish to attend the course “Introduction to R for spatial analysis” instead where we build on basic GIS skills (date to be confirmed).

Costs:

  • £30 – UK registered students
  • £60 – staff at UK academic institutions and research centres, UK-registered charity and voluntary organisations, staff in public sector and government
  • £175 – all other participants including staff from commercial organisations

Registration:

Details of registration will follow. Please email n.bearman@liverpool.ac.uk to reserve your place.

Location:

Information on getting to the University is available at: http://www.liv.ac.uk/maps/visiting/

A map of the campus is available at: http://www.liv.ac.uk/files/docs/maps/liverpool-university-campus-map.pdf

The Sydney Jones Library is number 423 in grid F3 on the map.

Using QGIS to create a Publication Quality Map

We use QGIS on a regular basis in our teaching for a wide range of GIS practicals. We have created a version of one of the practicals you can try out for free. We use QGIS’s Map Composer to create a publication quality map. All the data you need is included in the zip file linked below.

This practical uses QGIS version 2.2, and we will be posting an updated version when we have time to update it. If you have any comments, we welcome them – please post below.

Download Practical Handout (PDF, 939 KB) and Data (zip file, 2.4 MB).

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en. This means you are free to use, reuse and adapt the practical for non-commercial use, as long as you attribute and link to Spatial Spider. 

Using R as a GIS

Recently I ran two courses on using R as a GIS. R can be a very flexible open source GIS, with many many examples across the web. However, it can have a steeper learning curve that ArcGIS or QGIS – however don’t let this put you off! It is very powerful when you script it, making resources like the 2011 Census Open Atlas easier to create. 

Crimes in LiverpoolThe first course focused on using Google Maps with R, showing how to use GGPlot2 to create maps with a Google Maps backdrop. We used R and R Studio, and covered importing and displaying point, line and polygon data. The worksheet is available, as is the presentation I gave.

The second course focused on using R for Geodemographic Analysis, using R’s built in plot command to display spatial data. We looked at the Output Area Classification geodemographic dataset and calculating index scores. The worksheet is available, as is the presentation I gave.

Both courses are licensed under the Creative Commons Attribution-ShareAlike 4.0 International License and free for you to use and re-use, subject to attribution. I would encourage you to let me know if you find them useful, and if you want to re-use the exercise, the files are available in GitHub repositories (Google Maps with R, R for Geodemographic Analysis) which you can fork

Cross-posted from http://geographicdatascience.com/training/2014/07/10/R-GIS-Workshop-Material/.

Reprojecting data from Police.uk from WGS84 to BNG

I have recently taken over a second year undergraduate module, ‘Applied GIS and Modelling’. The first practical element of the course (spread over 8 hours of lab sessions over the first 2 weeks) introduces the students to GIS and using R to show, create and handle spatial data. One of the exercises uses crime data downloaded from the Police.uk website.

While going through the material, I discovered that the crime data available through the Police.uk website had changed format. The data file used last year previously contained coordinates in Eastings and Northings (the British National Grid projection system) now had coordinates specified in Latitude and Longitude (WGS84). The students go on to plot the crime data over some LSOA boundaries (which come projected in BNG) so it would be useful to have the crime data in the same projection. This is in the first practical, so while the students do need to learn about projections at some point, I would prefer not to have to throw them in at the deep end to begin with!

However, the data had changed, so I needed to find a simple way of reprojecting them. Fortunately with a few tweaks to the R code, I managed to incorporate this into the practical in a way that wasn’t too complex. The full practical is available at http://rpubs.com/nickbearman/gettingstartedwithr, and the bit relevant to this post begins about half-way down, at ‘Working with Open Government Data’. The steps to download the crime data from Police.uk are straight forward, and are covered in the practical. The students use data from Merseyside Police, as this is their local police area. This is all done using the MapTools library in R.

    #Load the library
        require(maptools) 
    #Read in the data
        crimes <- read.csv("2013-11-merseyside-street.csv") 

The next step reads the CSV data (with latitude and longitude fields) into a SpatialPointsDataFrame:

    #Show the head of the data
        head(crimes)
    #Create the coordinates
        coords <- cbind(Longitude = as.numeric(as.character(crimes$Longitude)), Latitude = as.numeric(as.character(crimes$Latitude))) 
    #Create SpatialPointsDataFrame, specifing coordinates, data and projection
        crime.pts <- SpatialPointsDataFrame(coords, crimes[, -(5:6)], proj4string = CRS("+init=epsg:4326"))

From the practical:
“This creates a SpatialPointsDataFrame object. This first line prepares the coordinates into a form that the SpatialPointsDataFrame can use. The SpatialPointsDataFrame function on the second line takes three arguments – the first is coordinates, created in the line above. The second argument is the data frame minus columns 5 and 6 – this is what -(5:6) indicates. The third argument is the projection. These columns provide all the non-geographical data from the data frame. The resulting object crime.pts is a spatial points geographical shape object, whose points are each recorded crime in the data set you download.”

Creating a SpatialPointsDataFrame from the CSV is straight forward, but remember to specify the projection – proj4string = CRS("+init=epsg:4326") in our case (WGS84). The [,-(5:6)] means that the data element of the SpatialPointsDataFrame contains everything in crimes (the CSV file read in) apart from columns 5 & 6. This is a new way of doing it for me, but quite effective!

Once the data is stored as a SpatialPointsDataFrame, the actual reprojection is easy – you essentially just say ‘reproject this data frame to this projection’, with +init=epsg:27700 being BNG:

    #Reproject data to BNG (27700)  
        crime.pts <- spTransform(crime.pts, CRS("+init=epsg:27700"))

As with many things in R, if it’s setup correctly, then a reprojection is quite easy to do (just one line in this example!). However, it is setting up the data correctly which takes time. Previously both the shape file of the LSOAs and the crime data were read in without any projection – fine if they are both the same, but to reproject it, both need their projections specifying.

Hopefully this R code will be useful to you – feel free to use it in any of your work.