5/31/2011   Consuming OrdnanceSurvey Open Data with Open     Source Software         Matt Walker and Jo Cook
The Grand PlanTo go from this:
The Grand PlanAnd this:
The Grand PlanTo this:
The Grand Plan             In 2 Hours!
Running Order1. Download Ordnance Survey Open Data and Mastermap   Sample2. Prepare it for use with open source tools and ...
Getting StartedBoot the liveDVD and login with the username user and thepassword userWelcome to XUbuntu!Click on the "Home...
Getting StartedChange the keyboard settings from US to UK by right-clickingthe US flag in the top-right corner of the scre...
Getting StartedWe need to update one piece of software on the disk.Open Applications (menu) -> System -> Synaptic PackageM...
Getting StartedIn the "quick search" box, search for gdal-bin.We are looking for version 1.8.
Getting StartedTick the box next to gdal-bin and choose "Mark for Upgrade".Click the "Apply" button and agree to the dialo...
Getting StartedFirst we need to get the data, and the scripts and tools thatwell use to work with it.In firefox download i...
Getting StartedThen we need to download some sample mastermap data fromthe Ordnance Survey, as their license prevents us f...
Getting StartedCheck the permissions on both the Workshop2011 folder, the_mapserverconfig folder, and the .map files.In Fi...
Creating the databaseWe are going to create a spatial database to hold theMasterMap and Vector-based Open Data.Open pgadmi...
Creating the databaseClick OK to create the database
Creating the databaseNext, we need to create some schemas in the database to holdthe different types of data.Select the SQ...
Creating the database
Loading the Ordnance Survey Open DataIn File Manager navigate to/home/user/Downloads/workshop2011/SoftwareMake the script ...
Loading the Ordnance Survey Open Data
Loading the Ordnance Survey Mastermap DataThis requires the same process as before, so navigateto /home/user/Downloads/wor...
Raster Data Preparation As downloaded from the Ordnance Survey, the raster data needs some preparation to make it useable ...
Raster Data Preparation To make the multi-tile raster datasets, such as OS VectorMap District (Raster) and OS Street View ...
Raster Data Preparation In File Manager, navigate to /home/user/Downloads/Workshop2011, right-click data and choose "open ...
Testing your map fileYou can view your map file directly in a web browser using thefollowing URL:http://localhost/cgi-bin/...
OH NO! Its all gone wrong!Errors will be shown in the browser window or in the log filesin /var/www/temp.
And finally...Once the map file is working correctly, its time to see theresults of all your hard work in a shiny OpenLaye...
Extra Credit: Viewing the Data in Quantum GISNow we have our vector data loaded into PostgreSQL, wecan view it in any stan...
Viewing the Vector Data in Quantum GIS
Viewing the Vector Data in Quantum GIS Click on the "Connect" button to make a connection to the database. In the main win...
Viewing the WMS in Quantum GIS  We can view our styled data as image data (not  clickable) in Quantum GIS.  Choose Layer (...
Viewing the WMS in Quantum GIS
Viewing the WMS in Quantum GIS  Click "Connect" to see the available layer groups from  your map file. Expand these to see...
Were Done!              Yay!
This would not have been possible without...                                OpenLayers
5/31/2011Thank You! Matt Walker and Jo Cook
Upcoming SlideShare
Loading in...5
×

Consuming and Publishing Ordnance Survey Open Data with Open Source Software

4,325

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
4,325
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
22
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Consuming and Publishing Ordnance Survey Open Data with Open Source Software

  1. 1. 5/31/2011 Consuming OrdnanceSurvey Open Data with Open Source Software Matt Walker and Jo Cook
  2. 2. The Grand PlanTo go from this:
  3. 3. The Grand PlanAnd this:
  4. 4. The Grand PlanTo this:
  5. 5. The Grand Plan In 2 Hours!
  6. 6. Running Order1. Download Ordnance Survey Open Data and Mastermap Sample2. Prepare it for use with open source tools and some clever python scripts3. Check it all works4. Display on a pretty openlayers map Simples!
  7. 7. Getting StartedBoot the liveDVD and login with the username user and thepassword userWelcome to XUbuntu!Click on the "Home" folder on your desktop to see where yourfiles will be stored
  8. 8. Getting StartedChange the keyboard settings from US to UK by right-clickingthe US flag in the top-right corner of the screen and clicking the"Add" button next to "Keyboard Layouts". Expand "UnitedKingdom" and choose "Extended win-keys" and hit "OK".
  9. 9. Getting StartedWe need to update one piece of software on the disk.Open Applications (menu) -> System -> Synaptic PackageManagerClick the "reload" button to reload the list of availablerepositories.
  10. 10. Getting StartedIn the "quick search" box, search for gdal-bin.We are looking for version 1.8.
  11. 11. Getting StartedTick the box next to gdal-bin and choose "Mark for Upgrade".Click the "Apply" button and agree to the dialogue aboutinstalling additional packages.
  12. 12. Getting StartedFirst we need to get the data, and the scripts and tools thatwell use to work with it.In firefox download into your "Downloads" folder:http://download.astuntechnology.com/public/Workshop2011.zipExtract Workshop2011.zip by right-clicking it and choosing"open with archive manager", and save in the "Downloads"folder.
  13. 13. Getting StartedThen we need to download some sample mastermap data fromthe Ordnance Survey, as their license prevents us fromdistributing it.In firefox, go to:http://www.ordnancesurvey.co.uk/oswebsite/products/try-now/sample-data.htmland download the OS MasterMap Topography Layer zip fileThis will be saved in your "Downloads" folder. Right-click it andchoose "Open with Archive Manager" and extract it to thefolder:/home/user/Downloads/Workshop2011/Data/OS MasterMap
  14. 14. Getting StartedCheck the permissions on both the Workshop2011 folder, the_mapserverconfig folder, and the .map files.In File Manager, right-click the folder or file and choose"Properties". Choose the "Permissions" tab and ensure that itis set to read-only for the "Others" group.If presented with a dialogue asking you to make these changesto sub-folders and files, agree to it.
  15. 15. Creating the databaseWe are going to create a spatial database to hold theMasterMap and Vector-based Open Data.Open pgadmin3 from Geospatial (menu) -> Databases -> PGAdmin III and expand the "Servers" list in the left-hand window.Double-click on "localhost" as that represents the localcomputer.Expand "localhost" and right-click on "Databases" to create anew database.This should be called mapbaseThe owner should be userThe template should be template_postgis
  16. 16. Creating the databaseClick OK to create the database
  17. 17. Creating the databaseNext, we need to create some schemas in the database to holdthe different types of data.Select the SQL window, choose the "open file" dialog and thenbrowse to the file:/home/user/Downloads/Workshop2011/Software/create-schemas.sqlThen click the "Execute Query" button to run the SQL
  18. 18. Creating the database
  19. 19. Loading the Ordnance Survey Open DataIn File Manager navigate to/home/user/Downloads/workshop2011/SoftwareMake the script load-os-opendata.sh executable by rightclicking the file in File Manager and in the Permissions tabchecking "Allow this file to run as a program" and click OKOpen a terminal window and type the following:cd /home/user/Downloads/Workshop2011/Software ./load-os-opendata.shThis might take a while... so well take a look at what dataweve included:http://www.ordnancesurvey.co.uk/oswebsite/products/os-opendata.html
  20. 20. Loading the Ordnance Survey Open Data
  21. 21. Loading the Ordnance Survey Mastermap DataThis requires the same process as before, so navigateto /home/user/Downloads/workshop2011/SoftwareMake the script load-os-mastermap.sh executable byright clicking the file in File Manager and in thePermissions tab checking "Allow this file to run as aprogram" and click OKOpen a terminal window and type the following:cd /home/user/Downloads/Workshop2011/Software ./load-os-mastermap.shThis will also take a while... so well take a look at thetools were using at http://www.gdal.org/
  22. 22. Raster Data Preparation As downloaded from the Ordnance Survey, the raster data needs some preparation to make it useable in mapserver (or any gis). Firstly, in File Manager, navigate to /home/user/Downloads/Workshop2011/Data and for each of the folders below, navigate into the named folder and move the georeferencing files, or .tfw files from ./data/georeferencing files/tfw to ./data, where the tifs are. Do this for each of the following folders: • 1 250 000 Scale Colour Raster • MiniScale • OS Street View • OS VectorMap District (Raster)
  23. 23. Raster Data Preparation To make the multi-tile raster datasets, such as OS VectorMap District (Raster) and OS Street View work more efficiently in mapserver, we need to create a tileindex for each dataset. This is a shapefile of polygons representing the boundaries of each raster tile, with an attribute location recording the relative path to the tile.
  24. 24. Raster Data Preparation In File Manager, navigate to /home/user/Downloads/Workshop2011, right-click data and choose "open terminal here". Type: gdaltindex "OS VectorMap District (Raster)/data/osvectormapdistrict.shp" "OS VectorMap District (Raster)/data/"*.tif Repeat for StreetView: gdaltindex "OS Street View/data/osstreetview.shp" "OS Street View/data/"*.tif Top tip: use the tab key to autocomplete directory and file names at the command line
  25. 25. Testing your map fileYou can view your map file directly in a web browser using thefollowing URL:http://localhost/cgi-bin/mapserv?map=/home/user/Downloads/Workshop2011/_MapserverConfig/OSOpendata.map&mode=map&layers=[layername]Substitute the name of a layer from your OSOpendata.map file(or the included map files)- remembering that it is casesensitive.Recall that some layers have a minimum and maximumscale at which they display. You can comment out these inthe map file for testing purposes, using the # symbol.
  26. 26. OH NO! Its all gone wrong!Errors will be shown in the browser window or in the log filesin /var/www/temp.
  27. 27. And finally...Once the map file is working correctly, its time to see theresults of all your hard work in a shiny OpenLayers map.Open a command prompt and type the following:sudo cp/home/user/Downloads/Workshop2011/Software/OpenLayers/opendatamap.htm /var/www/opendatamap.htmFinally, view the map in the browser athttp://localhost/opendatamap.htm
  28. 28. Extra Credit: Viewing the Data in Quantum GISNow we have our vector data loaded into PostgreSQL, wecan view it in any standards-compliant desktop GIS.Open Quantum GIS from the Geospatial (menu) -> DesktopGIS -> Quantum GISGo to Layer (menu) -> Add PostGIS Layer, then click "new"and fill in the following: • Name (can be anything) • Host- Localhost • Database- mapbase • Username- user • Password - user • Port 5432Tick the "save username" and "save password" boxes andtest the connection
  29. 29. Viewing the Vector Data in Quantum GIS
  30. 30. Viewing the Vector Data in Quantum GIS Click on the "Connect" button to make a connection to the database. In the main window, expand the schemas and choose a table (or tables) to load, and click "Add"
  31. 31. Viewing the WMS in Quantum GIS We can view our styled data as image data (not clickable) in Quantum GIS. Choose Layer (menu) -> Add WMS Layer. In the Layers tab, click "New" and give the server a name (like mapserver) and put in the following address as the URL: http://localhost/cgi-bin/mapserv? map=/home/user/Downloads/Workshop2011/_Mapserver Config/OSOpendata.map Leave the username and password blank, and click "OK".
  32. 32. Viewing the WMS in Quantum GIS
  33. 33. Viewing the WMS in Quantum GIS Click "Connect" to see the available layer groups from your map file. Expand these to see the available layers, and choose "Add" to add these to your map.
  34. 34. Were Done! Yay!
  35. 35. This would not have been possible without... OpenLayers
  36. 36. 5/31/2011Thank You! Matt Walker and Jo Cook
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×