Tip:
Highlight text to annotate it
X
Map Styling Tools and Interactive maps on the web with OpenLayers – Addy Pope, GoGeo
There’ll be a bit of overlap with the first presentation here but then I’ll move onto
OpenLayer. I work for EDINA and we are a National Data Centre supported by JISC to provide resources
to higher and further institutions. We run various projects and services around data
of all sorts – film, sound, data of various sorts. I sit in the Geo team and there are
a large group of us working on a wide variety of geo projects. We use a lot of OSGeo software
– Bob has a disc of this if you’d like one and he may talk more about that at the
end of my presentation. http://bestofosm.org/ is a great place to
find OpenStreetMap highlights – like mapping of Pompeii, CERN, etc. Bern has some great
mapping – down to the level of trees, house numbers etc. Some countries in Europe don’t
have Ordnance Survey mapping and therefore put a lot of this detail in to ensure there
are detailed maps of their area. Looking closer to home Britain’s most popular
mountain bike trail in Scotland – the forest is Scotland’s second biggest tourist attraction,
And in Edinburgh’s Southside Jo has been taking old historic out of copyright data
on architectural detail – she used a National Library of Scotland scanned map to trace from.
The National Library of Scotland has an ongoing project to crowd source the georeferencing
of out of copyright historic maps so there is
Cloudmade – we’ve already looked at the little blue + sign. We can see Mapnik, Osmarender,
Cucle Map, NoName. Cloudmade is a company that has spun out of OSM to do consultancy
work – they use the same data as everyone else but use their expertise of the data to
offer specialized services. Steve Coast, one of the original founders
– as is Jo Walsh – had set up Cloudmade though he’s now left. They tend to put up
useful stuff on http://maps.cloudmade.com/. It’s OpenStreetMap in a big viewer with
additional content. As an aside.. interestingly Apple has filed
a patent to patent maps. All maps. Conceptual and geographic maps.
One of the benefits of what OSM is doing is that maps can be rerendered for accessibility
purposes – I prepared this slide [of different renderings or "Styles" of maps of the same
area of Glasgow] – which can be quickly viewed on Cloudmade by clicking on a different
map Style. Some of these are primarily to make the maps look pretty but they can be
really useful. An alarming number of British males have colour issues and two of the main
colours on Ordnance Survey are red and green. OpenStreetMap can be rendered in pretty ways,
in different styles which can make them much more accessible – and you can create or
edit themes to meet your own needs. To do this login to Cloudmade and click “Edit
Map Styles”. Not all features are rendered in all styles
– so you should design your map with that in mind. If you want to design a large scale
map you will want to make it look different to a small scale map – always think about
the purpose when you design a map. So here you can see that I’ve made the main
roads red on this map, then minor roads in washed out brown, motorways are in blue, green
roads are trunk roads.It took about 5 minutes to design this, lets go in and edit it now…
From this style editor you can choose to filter out features and customise your map for your
needs. You are creating your own StyleSheet – it’s a bit like CSS/a stylesheet but
it’s stored as xml. So, we can look at the xml and see a series
of rules here about the colours and styles to use for different types of features and
lines, which should or should not be displayed. We’ve created all of this from that simple
. Mapnik can take this xml from OpenStreetMap and render it for you. You can download Mapnik
– I tend to use a bundle from OSGeo which combines Mapnik and OSGeo4W. That bundle is
available for PC and Linux, not sure about Macs.
Bob) OSGeo are Open Source Geo and they do try to make things cross platform. The DVDs
I have here are the full bundle but you can install all of these from the web as well.
So Mapnik turns your styles and map data into an image of a map but if you want to create
something interactive you need to go further and use OpenLayers. You probably already use
OpenLayers in a variety of web mapping tools. So, for instance, here is how we use it in
Digimap – this is all Ordnance Survey rather than OSM data. This is rendered as an image
from the server. So you have basic mapping controls and also things like annotation tools
– so you an add shapes and lines etc. This functionality is customised from OpenLayers
toolkits essentially. If you used OSM as your WMS in the background you could do much the
same. We serve a WMS not a WFS so you can do some interaction with features but not
in the same detail Q – Andreas) Do you have any experience
with WFS and can you give any advice on those? A) I don’t personally but we do at EDINA
as we do services like UKBorders so I can certainly put someone in touch with you.
Moving on… There is a good side to find OpenLayers ideas, examples, tools etc. and
will identify the code for you to use: http://openlayers.org/dev/examples/ Bob) The examples site is really good. You
can start with simple stuff and then look at more complex code and concepts. The community
is developing stuff all the time so the examples here can get behind what’s already happening
out there. “Slippy maps” are very often done with
OpenLayers. Q) Don’t you need a licence or API key to
create stuff with Google Maps – like this OpenLayers example?
A) Yes, and you need to look carefully at what you can and can’t do as there are restrictions.
So… What if I have some of my own data that I want to show on a map? We can use QGIS to
do most of the hard stuff. It’s a free open source GIS package that runs on Window, Linux,
and Macs. It’s easy to use and well supported by a very active community.
So, the recipe looks a bit like this: • take some data
• load into QGIS • download the OGR2 plugin…
So, a shameful plug here, I am starting with ShareGeo Open, a repository for sharing open
geo data – email me if you’d like a login. There is some really interesting data in there
going in from Chris Fleet of the National Library of Scotland from historic map sources
for instance but there are also research sets etc.
I’m starting with a map of NationalParks in the UK – this is from Strategi, an Ordnance
Survey Open product. There’s one trick here in QGIS – and it’s not in the Help section
for the plugins. You need to go and check the box in your QGIS Plugin Manager to allow
third party plugins. You are looking for OGR2Layer (from Python repository in QGIS). All of these
plugins are built with Python. Make sure you click the “yes” button to accept other
symbology. You then use this plugin to export your data to OpenLayers which creates GeoJSON
of your data and a WMS of OpenStreetMap data with a rendering of your choice (it creates
two files – GeoJSON and an index file). You have some rendering options. The file
you put in must have a geographic projection as this is used to create the GeoJSON. Open
the GeoJSON in any browser – even IE (though you may need to hit CTRL-F) – it will combine
your local data with the OSM map. It’s a great starting point.
Andreas) I can also recommend MapTime – more rastor data – you can choose background
layers, can use API etc. I can show this later. Q) Can you make those layers interactive?
A) Yes, you can. So taking 2 more ShareGeo data sets – nucleur power plants and earthquakes
since 1900 – we can create a map that you can interact with through queriable attributes
and view multiple types of data. And finally here is a canned example of campus
buildings for Edinburgh University… And shameful plug 2: you can also use other WMS
with QGIS, like the OpenStream service EDINA runs!