Clipping a Surface By a Polygon

Background:

A common function in standard GIS software enables users to create a raster surface and extract values or clip it based on a set of polygons. This may be used in cases where you want analysis to be constrained to within a town’s boundaries or a coastline. This tutorial will outline how to create a surface using kernel density estimation (KDE) and then clip the surface so that it is constrained within the City of London Boundary.

Data Requirements:

City of London Boundary Shapefile: Download (requires unzipping).

London Cycle Hire Locations: Download.

Install the following packages (if you haven’t done so already):

sm, maptools.?

Click here to view the code.