This version of the course is several years out of date and parts of it will not work - it is here just for the benefit of my 2022 dissertation students who want some grounding in Leaflet and associated technologies.

Week 10 Solution

<!DOCTYPE html>
		<!-- This is the HEAD of the HTML file, things in here do not appear on the page. It is 
		 used for settings, such as the language and page title, as well as loading CSS styles and 
		 scripts that you want to load before the content of the page. --> 
		<meta charset="UTF-8">
		<title>GIS and the Web</title>
		<!-- This is loading the stylesheet for the Leaflet map from their website. 
		 Make sure you put this BEFORE Leaflet's JavaScript -->
		<link rel="stylesheet" href=""/>

		<!-- This is loading the Leaflet JavaScript library from their website
		 Make sure you put this AFTER Leaflet's CSS -->
		<script src=""></script>
		<!-- Load Turf.js -->
		<script src=""></script>
		<!-- Load London Underground Dataset-->
		<script src="data/underground.js"></script>

		<!-- This is where we set the style for the different elements in the page's content -->
			/* Style the map */
			#map {
				width:  800px;
				height: 500px;
	<!-- The onload event of the body tag is being used to call the function that creates the map.
	 This means that nothing will happen until the body is completely loaded, giving us a little more
	 control over the order in which the web page loads. -->
	<body onload='initMap()'> 
		<!-- This is where the map will go -->
		<div id='map'></div>
		<!-- This is where we put our JavaScript, note that it is below the div, as the div needs
		 to exist before we can put a map in it!-->
			//setup global variables
			var map, geojson;
			 * Initialise the Map
			function initMap(){
				// this is a variable that holds the reference to the Leaflet map object
				// creates a world map (centre where the equator crosses the GPM)
				map ='map').setView( [51.48728233102447, -0.11360004378767831], 12);

				// this adds the basemap tiles to the map
				L.tileLayer('{z}/{y}/{x}', {
					attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ',
					maxZoom: 16
				// call a function to add the journeys to a map
			 * Load the journey lines onto the map, styling intelligently into 5 equal classes
			function journeysToMap() {
				// loop through each journey
				for (var i = 0, lines = []; i < journeys.length; i++) {
					// make a line and load into the array
						[ parseFloat(journeys[i]['startX']), parseFloat(journeys[i]['startY']) ], 
						[ parseFloat(journeys[i]['endX']),   parseFloat(journeys[i]['endY'])   ]
				// compile into featurecollection and add to the map
				geojson = L.geoJson(turf.featureCollection(lines), { }).addTo(map);

This course has not yet begun.
Course material will appear here week by week as the course progresses.