Getting Started
One of the issues with GIS is that many of the files we will be working with are quite large. Fortunately, in recent years, UCL has seriously beefed up the storage available for students. You now get 100GB of free storage, which should be plenty for the work you will be doing this year! The Bartlett faculty has several gigabytes of storage space available on their central servers, so before we get started, we will connect to our N drive to carry out all of our practical work over the coming weeks.
In your N drive: drive, create a new folder called GIS and within this a subfolder called wk1
Wlecome to the world of GIS
Spatial analysis can yield fascinating insights into geographical relationships. However, at times it can be difficult to work with. You will get lots of error messages and have software crash. The academic staff are here to help you work through these practicals but we do not know everything. It’s a good idea to become familar with online sources of help, such as:
There are two main types of data which are used in GIS applications to represent the real world. Vectors – Points, Lines and Polygons and Rasters – Grids of cells with individual values.
Real world
Raster
Vector
In the above example the features in the real world (e.g. lake, forest, marsh and grassland) have been represented by points, lines and polygons (vector) or discrete grid cells (raster) or a certain size (e.g. 1 x 1m) specifying land cover type.
We will look into these in more detail in future lectures, but in this course, most of the data we will be dealing with will be vector data, although raster data will feature in later weeks.
There are a number of commonly used geographic data formats that you will come across during this course and it’s important to understand what they are, how they represent data and how you can use them.
GeoJSON (Geospatial Data Interchange format for JavaScript Object Notation). See: http://geojson.org/ is becoming an increasingly popular spatial data format, particularly for web-based mapping as it is based on JavaScript Object Notation.
Perhaps the most commonly used GIS data format is the Shapefile. Shapefiles were developed by ESRI (http://www.esri.com/) – one of the first and now certainly the largest commercial GIS company in the world. Despite being developed by a commercial company, they are an open format and Shapefiles can be used (read and written) by a host of GIS Software applications.
A shapefile is actually a collection of files – at least three of which are needed for the shapefile to be displayed by GIS software. They are:
We’re now going to explore GeoJSON and shapefiles in action. Go to: http://geojson.io/#map=16/51.5247/-0.1339
Most raster data is now provided in GeoTIFF (.tiff) format, which stands for Geostarionary Earth Orbit Tagged Image File. The GeoTIFF data type was created NASA and is a standard public domain format. All necesary inforamtion to establish the location of the data on Earth’s surface is embedded into the image. This includes: map projection, coordinate system, ellipsoid and datum type.
Aforementioned data types and formats are likely to be the ones you predominately encounter. However there are several more used within spatial analysis. Theres include:
Vector
Raster
There are normally valid reasons for storing data in one of these other formats. For example, BSQ are just data with a seperate text header file (.hdr) providing geographic spatial reference information. Earth observation data often monitors the electromagenitc spectrum in bands. Humans see in the visible range of the spectrum and our vision is composed of red, green and blue wavelengths. If we wanted to analyse just the red wavelength the BSQ format would let us ‘read in’ only that data. In comaprsion a GeoTIFF might come with all the data ‘packaged’ in one file and when doing analysis over thousands of images would significantly slow things down. That said you can now often find GeoTIFFs seperated in a similar format to BSQ and it’s fairly straightforward to convert between raster formats. Often the most successful projects and reports will combine numerous datasets from various sources (and formats) to glean new insights.
A geodatabase is a collection of geographic data held within a database. Geodatabases were developed by ESRI to overcome some of the limitations of shapefiles. They come in two main types: Personal (upto 1 TB) and File (limited to 250 - 500 MB), with Personal Geodatabases storing everything in a Microsoft Access database (.mdb) file and File Geodatabases offering more flexibility, storing everything as a series of folders in a file system. In the example below we can see that the FCC_Geodatabase (left hand pane) holds multiple points, lines, polygons, tables and raster layers in the contents tab.
A GeoPackage is an open, standards-based, platform-independent, portable, self-describing, compact format for transferring geospatial data. A GeoPackage stores multiple spatial data layers (vector and raster) as a single file. One of the major advantages of a GeoPackage is the ability to analyse geographic data in SQLite producing code based, reproducible and transparent workflows. A GeoPackage is an SQLite database, a widely used relational database management system and as it stores data in a single file it is very easy to share, copy or move.
SpatialLite is an open source library that extends SQLite core. Support is fairly limited and most software that supports SpatiaLite also supports GeoPackage as they both build upon SQLite. It doesn’t have any clear advantage over GeoPackage, however it is unable to support raster data.
PostGIS is an opensource database extender for PostrgeSQL. Essentially PostgreSQL is a database and PostGIS is an add on which permits spatial functions. The advantage of using PostGIS over GeoPackages is that it allows users to access the data at the same time, can handle large data more efficiently and reduces processing time. In this example (https://medium.com/@GispoLearning/learn-spatial-sql-and-master-geopackage-with-qgis-3-16b1e17f0291) calcualting the number of bars per neighbourhood in Leon, Mexico the processing time reduced from 1.443 seconds (SQLite) to 0.08 seconds in PostGIS. However, data stored in PostGIS is much harder to share, move or copy.
The variety of data types and formats can see a bit overwhelming. But don’t worry, most of the time you’ll be using shapefiles, GeoPackages or raster data. You just need to be aware of the all the different types so that later on in the course if someone is talking about PostGIS data you are aware that it is a type of spatial data.
The volume of geographic information which is freely available for use in the UK is increasing exponentially, and spatially referenced data can often be found in many different places. In this practical we’re going to use data from the London data store - a free and open data-sharing portal provided by the Greater London Authrotiy (GLA), also known as City Hall that is the devovled regional governance body of London.
We are going to get spatial data of the London boroughs and join fly tip data that is provided as a .csv file. .csv stands for comma-separated values (CSV) - it uses a comma to separate each value.
At the end of this document I’ll also run through some common sources of data that will stand you in good stead for the rest of the course.
Firstly we need to get the outline of the london boroughs. The geographic boundaries that are used in the UK are a complex, often inter-related, but ever changing mass of areas. For anyone new to the UK (or indeed not a trained quantitative geographer), it can be quite a daunting task to attempt to understand all of the boundaries that are in use. Fortunately the Office for National Statistics has an online beginners guide to UK geography. If you need more information on the vast array of different UK geographies, this is the place to start: http://geoportal.statistics.gov.uk/datasets/a-beginners-guide-to-uk-geography-2018-v1-0
To get the data go to: https://data.london.gov.uk/
Seach for Statistical GIS Boundary Files for London
Download the statistical-gis-boundaries-london.zip
Unzip the data and save it to your week 1 folder.
On the same website search for fly tipping incidents
Download the .csv file
Question Open the .csv in Excel, what do you notice about how the data is stored?
Answer The year is a column and for each area the values are repeated for different years. In our analysis it is easier to have the different years as a field row and populated for each area. By this I mean, we want to go from this…
To this…
There are many ways to do this, as we are going to use this dataset in Arc Map, QGIS and R I’ve done it in Excel using a pivot table.
Go to Insert > PivotTable.
Select the original table and create a PivotTable in a new worksheet.
The PivotTable Field box will appear, experiment with the different fields in each of the areas.
I’ve used the following:
Note how I’ve altered the total_action_taken to the sum of… as the original was displaying incorrectly, to do so:
It’s important to think about what data we actually need in the next step, it’s good practice to avoid data redundancy where possible. The spatial data we have downloaded containts borough name and we will link based on code.
Now save the Excel sheet that contains the pivot table as a new .csv. Make sure that the first row of data holds the coloumn titles. Remove all empty rows.
When saving the file also avoid any special characters (e.g. -) and spaces, use an underscore instead of spaces.
Now it’s time to load, inspect and do some basic manipulation of this data. As mentioned in the lecture there are several GIS software ‘types’, here we will repeat the same process across Arc GIS, QGIS and R. Each system has specific benefits, but in general there has been a recent shift towards the use of QGIS and R, both being opensource. Arc GIS was the first major spatial analysis software produced by the Environmental Systems Research Institute, Inc. (Esri), founded in 1969 by Jack Dangermond. Due to its high cost and lack of customisation it is now less commonly used within the research community.
ArcGIS should be installed as a standard programme in the UCL desktop and you should be able to navigate to it from the Windows start button.
As a UCL student, you can install ArcGIS on your own computer. This is easy if you have a PC, but if you have a Mac this can be trickier as Arc will only run in a PC environment. If you have a Mac, the options open to you are either to:
If you can, it is preferable to run Arc on Bootcamp as virtualisation software can be slow. The Desktop@UCL facility should suffice for this course, however. ArcGIS (Version 10.6 is the latest at time of writing, but may have already been superseded) can be downloaded from the UCL Software Database for free - https://swdb.ucl.ac.uk/.
ArcGIS is a huge and complex piece of software, but thankfully is has an excellent help system – depending on the version you are using (they are all quite similar anyway) you can access the online help system here:
ArcGIS is actually a whole suite of software built and maintained by ESRI - http://www.esri.com/software/arcgis - and is perhaps the most widely used price of GIS Software in the world. Other software such as MapInfo and QGIS (which is open source and free to run) work in similar ways, so if you understand Arc, you will be able to pick up these other pieces of software very quickly. Within the ArcGIS for Desktop suite you will find the following programmes:
ArcCatalog - Similar to Windows Explorer, ArcCatalog allows you to manage your GIS files, folders and geodatabases
ArcGIS Administrator - This programme us used to manage licences for the various elements of ArcGIS
ArcGlobe - ArcGlobe allows you to view and analyse your data in 3D – this interface looks very similar to Google Earth and is part of the 3D analyst extension
ArcMap - This is the programme you will use most often – it is the main mapping and spatial analysis element of ArcGIS
ArcScene - ArcScene is a 3D viewer which allows you to navigate and interact with your 3D raster and feature data
ArcCatalog and ArcMap are in bold as these are the only programmes we will be using explicitly in this course. By all means experiment with the others if you have any spare time!
Find and run the ArcCatalog piece of software
Once ArcCatalog Opens, go to File > Connect To Folder… and navigate to the N:folder, right click in the contents area and create a new Flie Geodatabase.
You can import data layers into a Geodatabase within ArCatalog, however we will do this in ArcMap.
ArcMap is the core of the ArcGIS suite and where you would normally produce maps, carry out spatial analysis functions and automate processes. Find ArcMap in your start menu and run the programme. When the programme starts, you should see something similar to the image below. ArcMap has various elements to the graphical user interface, but here some of the key buttons are highlighted:
Note, while we have loaded the shapefile, it is not stored in our Geodatabase yet.
Useful tips
To the right of the document you will see the Catalog and Search tabs.The Catalog tab is a small version of ArcCatalog and will let you see what data is stored in the current Geodatabase. The search tab will let you find any analysis tool within ArcGIS. Try searching for Clip.
If you right click on the boroughs layer you will see various options. Zoom to layer is very useful if you ever get lost in your ArcMap document.
We’re now going to join our fly tipping data to the lonon borough shapefile. So:
You will get errors, ArcGIS does not like fields starting with numbers (e.g. 2012), dashes (e.g. -) or spaces.
Note, the join we have made is not permanent. To do so we need to export the layer.
Now lets use the data we’ve joined to create a basic thematic map.
You should have something that looks like this:
We haven’t talked about the spatial reference of our map document
A spatial reference is a series of paramters that define the coordinate system. Within GIS we use geographic or projected cooridnate systems. The former uses a three-dimesional spherical surface to define locations of earth, whereas the latter is defined on a flat, two-dimesional surface giving it constat lengths, angles and areas.
In ArcMap we can specify what cooridate system we want to use by:
You’ll see that it is already set to Projected Coordinate Systems, National Grids, Europe, British National Grid. This is because ArcMap will default to the cooridnate system of the first data layer loaded.
Save your ArcMap document. We’re now going to replicate this task in QGIS.
QGIS is very similar to ArcMap except that as it is open source and free there are many add on packages that (or plugins) that add functionality to the software.
To get QGIS on your own machine go to: https://qgis.org/en/site/forusers/download.html
Navigate to your downloadrd fly tipping csv file.
Add an appropaite layer name
Under Record and Field Options select the First record has field names box
Under Geometry Definition, select No geometry (attribute only table)
Then click Add
In the bottom left of QGIS under layers you should see your csv table now loaded. If you right click on it and select open attrbiute table you can explore the data within it.
Census Geography at Edina - https://census.edina.ac.uk/
The UK Data Service geography service (formerly known as UKBORDERS) actually provides much more than just boundaries for the geographies that are used to disseminate Census information – it has a library of hundreds of current and former boundary datasets for which attribute data are produced in the UK.
The Office for National Statistics (ONS) are the national statistical agency for England and Wales and have recently started to provide access to boundary data for the statistics they produce for various geographic areas.
Many of the boundaries on the ONS Geoportal are also available from the Edina Census Geography website in a more flexible fashion, however the ONS website provides very quick access to bulk-downloads – something which can be very useful when reading data directly from the web using computer software.
The Ordnance Survey (OS) are the national mapping agency for the UK. A few years ago, they opened up a number of their data products for public use including greenspace, OS Open Map and OS Terrain.
For the full range see: https://www.ordnancesurvey.co.uk/business-and-government/products/finder.html?Licensed%20for=OpenData%20(Free)&withdrawn=on
Before the Ordnance Survey opened up much of its data for public use, academics and students in the UK could access OS data using the Edina Digimap Service – this service is still available today and provides access to a number of products in addition to those available from OS Open Data.
Perhaps the most exciting of the additional OS data products available from Digimap is OS MasterMap. MasterMap is a framework for all OS data and contains layers of data that include details of real world objects such as buildings, roads, paths, rivers, physical structures and land parcels, as well as the complete UK transport network. Whilst we still are required to go through Edina OS have recently annonced plans to make this dataset free in the near future under the new Geospatial Commission.
Open Street Map is a fantastic resource – as the name suggests, all data contained in Open Street Map are open and free for anyone to use. Much like Wikipedia, anyone can contribute content to OSM and this brings with it its own benefits (frequent updates, very large user-base) and problems (data quality and patch coverage).
It’s possible to download OSM data straight from the website, although the interface can be a little unreliable (it works better for small areas). There are, however, a number of websites that allow OSM data to be downloaded more easily and are directly linked to from the ‘Export’ option in OSM. Geofabrik (one of these websites) allows you to download frequently updated Shapefiles for various global subdivisions.