Categories
Mashups OpenStreetMap

Map of UK Scenicness… and Pubs

picture-5

Here’s a little something [no longer online] I knocked up, based on the MySociety scenic score data release last week, as well as OpenStreetMap’s data for the UK – including particularly its pubs.

Basically, the vote point data was converted to a surface, using an IDW (Inverse-Distance Weighted) function. The cell size was pretty small (1km), so there isn’t much smoothing across many vote locations going on – a single vote may cause quite a steep gradient. Instead, the surface effectively extrapolates the values into all areas. Some jiggery-pokery was required to first project the votes onto the British National Grid (so that x/y distances become equivalent) and then the resulting surface was fully rasterised and reprojected to Spherical Mercator so that it could be tiled under the existing OpenStreetMap network overlay. This was surprisingly painful to do.

Note that the photographs that were voted on generally weren’t of the pubs shown on the map, so the pub might well be extremely photogenic – but in an area where the nearest Geograph photos used in the dataset for the voting were not rated highly.

It’s good to see that the Scottish Highlands come out so green (i.e. scenic.) Urban areas generally don’t do too well, although the voting was generally quite critical, so a yellowish hue is still a sign of a very scenic part of a city.

Data came from MySociety (using photographs from Geograph) and OpenStreetMap. The pub icon came from Wikimedia. The map tiles were produced using Mapnik for the OSM network overlay and MapTiler for the scenic map. The increasingly excellent OpenLayers is used to display the tiles, and a point vector layer showing the pubs.

There’s many areas with apparently no pubs at all. This is simply because the data wasn’t in OpenStreetMap when I pulled it in on Friday. However OpenStreetMap’s data is rapidly becoming more complete throughout the UK at the moment, so a future pull of the data should reveal many more pubs.

Some very remote areas don’t have any vote data either, but the production of the surface uses and extrapolates the values from nearby votes instead.

scotland
Categories
OpenLayers

Spherical Mercator Maps in OpenLayers 2.8

Following on from my previous post, it is indeed much easier to put Spherical Mercator “Google-style” maps into OpenLayers, following the 2.8 release this week.

Spherical Mercator is a pseudo-spatial reference system (SRS) that takes some liberties with strict geographic accuracy, to provide a projection that requires the minimum of maths to compute – as this is done on the fly in the user’s browser for OpenLayers-based maps, this is important. (More details.) Maps using Spherical Mercator often use a very hierarchical tile structure – tiles being the generally 256×256 pixel square GIF or PNG images that form the basis of many of the mainstream online “slippy” maps.

Google Maps, OpenStreetMap and NPE-OSM are three sources of tiles using the Spherical Mercator SRS – which the geographers here at UCL have taken to calling WebMercator, and is also known as EPSG:900913 (the numbers representing Google in l33t-speak…) – it has now also been assigned an official EPSG number of 4375 3857. Yahoo and Microsoft Virtual Earth also use Spherical Mercator but a different naming structure for their tiles. The common CRS for all these raster images allows them to be swapped out easily on web maps, which the Mapstraction project aims to achieve.

OpenLayers has an excellent page about Spherical Mercator and has some simple examples to get such a map up and running.

Anyway, I have a large number of sets of tiles in Spherical Mercator, for a project to be launched in the (hopefully near) future. It is now this easy to set them up as layers in OpenLayers.

The map itself still needs to be set up with care:

var bounds = new OpenLayers.Bounds(-30, 40, 15, 70); 
//Fits comfortably around the UK.

map = new OpenLayers.Map ("map", 
{
    controls: [
        new OpenLayers.Control.Navigation(),
        new OpenLayers.Control.PanZoomBar(),
	new OpenLayers.Control.Attribution(),
	new OpenLayers.Control.MouseDefaults()
        ],
    maxExtent: bounds.clone().transform(
        new OpenLayers.Projection("EPSG:4326"), 
        new OpenLayers.Projection("EPSG:900913")), 
    numZoomLevels: 18,
    maxResolution: "auto",
    units: "m",
    projection: new OpenLayers.Projection("EPSG:900913"),
    displayProjection: new OpenLayers.Projection("EPSG:4326")
});

I’ve created a function to create each layer:

function getChoroplethLayer(name, attrib)
{
    return new OpenLayers.Layer.OSM("", 
        "/tiles/" + name + "/${z}/${x}/${y}.png", 
        {numZoomLevels: 14, transitionEffect: "resize", 
          attribution: attrib});
}

Then it’s just a case of running through the layers:

layer_choropleth_1 = getChoroplethLayer("choropleth_1", "X");
layer_choropleth_2 = getChoroplethLayer("choropleth_2", "X");

…and adding them to the map:

map.addLayers([layer_choropleth_1, layer_choropleth_2]);

Easy!

If you want OpenStreetMap’s default Mapnik map tiles themselves, then it’s even easier:

map.addLayer(
    new OpenLayers.Layer.OSM(null, null, 
        {transitionEffect: "resize"}));
Categories
OpenLayers

OpenLayers New Release

OpenLayers, the open source Javascript framework for delivering powerful “slippy” maps via your web browser, has just had a new version released – 2.8. It’s the first release since September last year and is brimming with new features and bug fixes.

If the number of presentations mentioning OpenLayers at Monday’s OS GIS conference is anything to go by, there’s a lot of OpenLayers-powered sites out there now, many of which will benefit from the upgrade. Not least, getting OpenStreetMap base-mapping onto your OpenLayers website just got a whole lot easier. (And will get easier still once the documentation is written!)

Categories
Conferences

OSGIS UK Conference

I was on a very early train on Monday morning, to attend the First OSGIS UK Conference at Nottingham University, hosted by the Centre for Geospatial Science there.

Thanks to the the very tight schedule (speakers generally only had 15 minutes) I was able to see 23 presentations during the day. Most were good, and some were great – it was inspiring to see (a) what people were doing with open source GIS software and (b) how seriously everyone was using the tools – not just as an aside to their regular work but to create real, industrial strength applications for delivery to government bodies and industries.

Some themes came out very strongly – OpenLayers and the GDAL tools were, it seemed, mentioned by nearly every speaker. Certainly, the web browser is the point of delivery for many of the OS GIS projects happening now. Somewhat surprisingly, the map cartography engine Mapnik wasn’t mentioned at all. Less of a surprise, perhaps, was that OpenStreetMap was mentioned in just one talk. Indeed, there was little discussion of open data itself in general – the focus was much on utilising the open source applications and data formats, particularly those under the OSGeo umbrella. There was also no discussion on developing new revenue models from developing open source solutions. Maybe everyone has figured that one out already?

The audience, of around 150 people, was mainly commercial – ESRI and CadCorp (on the app side) and Ordnance Survey and EDINA (on the data side) were all in attendance. Only ~10% were in academia, although around half the talks were given by academics.

It might be the OSGIS UK conference, but there was an excellent representation from around Europe. One of the final sessions was by the European Commission, and many of the individual presentations were from universities around the continent. This reflects that much of the core OS GIS development itself has been driven by academia, such as GRASS in the US and gvSIG in Spain.

Though one of the keynotes was given by the head of the ICA (International Cartographic Association), there were hardly any cartographic presentations, and not really any on geovisualisation either. Perhaps I’m just now starting to appreciate that the “geo” world is actually split into at least four distinct fields – cartography, geovisualisation, GIS analysis and neogeo hacking, with less overlap than I might have thought. The State of the Map conference next month should provide me with my neogeo fix.

Anyway, the talk that won the best presentation award was the one I also liked best – it was well delivered and described a system that was designed for resilience and scalability – something that the best commercial systems can fail to achieve on launch day. It was Mapping Future Climate by Philip James et al at Newcastle University – the system was launched by the government last week and delivers complex models to any one that wants to see them, presented in an attractive way using Open Source tools. The talk also discussed the unusual projection system being used by the Met Office – yet another custom one, to join the thousands of EPSG-designated ones already out there! I also emphasised strongly, as did many in the audience, with the pains of adapting the site for use with IE6 – I’ve spent a couple of days recently pulling my hair out about this particular point. You can see the system here.

I also particuarly liked:

  • Map Warper by Tim Waters, which is essentially an attractive web-based GUI sitting on top of GDAL tools for georeferencing (or “orthorectifying”) rasters. It works well with scans of paper-based maps and aerial photos. I’ve used the Microsoft MapCruncher and the QGIS Georeferencer myself but this looks like a really nice way to do it. Mike also touched on the idea of getting an Open Historical Map project. This is something that the simple Marr Map Mashup in OpenLayers that Alex (my boss) and I did a couple of months back, could contribute to. Tim is also looking at orthorectifying the 10,000 scanned maps in the New York Public Library collection. I was particularly interested in his comments that the underlying GDAL tools are extremely fast, even for large and complex rasters. Not what I’ve found when using them myself, although I may be approaching them in a different way.
  • Sextante by Victor Olaya et al at the University of Extramadura (Spain), a very comprehensive set of over 230 geoprocessing tools, designed to integrate with the various Java-based OS GISes. Similar I think to the Arc Geotoolbox, it has a very similar GUI for building up chains and sequences of operations. In Quantum GIS (my GIS of choice at the moment) there is a similar plugin called fTools, and GRASS has all the operations you could ever need. But Sextante looks very feature rich and the web version uses the Ext-JS framework (as do a number of applications presented) which makes it look very polished indeed.
  • OS GIS for Teaching by Rita Engermaier at the University of Potsdam (Germany). An interesting outline of how students responded to being taught OS GIS applications compared with Arc. A pertinent question was asked at the end though – GIS-based employers will still be looking for specific Arc skills for some time to come. Another similar talk, on OS GISes being used in universities in general, raised the important challenges that (a) staff already know and have the proprietary GISes so why change, and that (b) it’s straightforward to justify purchasing them with departmental budgets, so there’s no perceived benefit of saving the money.
  • SPIRE and Open Source by Rob Booth (IBM) – looking at how open source tools were helping Defra manage and display some of its huge sets of diverse geographic data.
  • Aerial Photo Processing in GRASS by John Stevenson et al at the University of Manchester. This was excellent and a very close contender for my favourite paper – it showed off the power of using GRASS – on the command line no less! – to process remotely sensed data. I wonder if my void filling and hill-shading, that I’ve tried to do with the GDAL tools with only partial success, would be better done in GRASS. Its learning curve was acknowledged but it might be time for me to get stuck into it. I was also very interested to hear about GMT – a toolset which includes the capability to create attractive contours. My own contours, derived using GDAL tools from the SRTM DEM, are not very pretty, so I’ll have a look at it.

Everyone got a 2GB USB key with the conference papers pre-loaded on it which was a nice touch.

A few more notes on some of the other talks:

  • The Ordnance Survey have moved to the more up-to-date OpenLayers 2.7 for their OpenSpace fork. They are also overhauling their lower level OSGB Web Tools package to be a bit more user-friendly, and are planning several releases in the next few months.
  • PostGIS has applied to be part of the OSGeo family. Makes a lot of sense, it’s great to have an organisation packaging and marketing an excellent suite of production-ready OS tools, and with PostGIS, the full stack is there. Now let’s have Mapnik there too!
  • The European Commission have their own licence – the EUPL – for publically-funded work designed for use by public authorities. It’s “yet another” OS licence but is compatible with the various main OS licences (GPL, Apache) but designed to be enforceable across all the member states’ jurisdictions. It’s more of a “marketing” thing, apparently, to help encourage OS software use by administrations across the continent. They also have “yet another” code sharing platform, OSOR.eu, where code can be hosted, if it’s publicly financed and open source. Sextante and gvSIG are two projects using the “GIS/SDI” area on OSOR – it can also act as the underlying repository while the project’s own development portal keeps its branding. The pan-European nature could potentially be very powerful for raising awareness of OS projects in the public sector.
  • There were some lower-level talks, on data and semantics – areas that might not be so glamorous, but are still interesting. These included an outline of the GeoSciML schema for describing geological data, and defining a rules-based language for geospatial constructs, such as how a feature can be identified as being a roundabout, for possible use in the pan-European INSPIRE initiative.
  • The OSGeo UK group is new and is perhaps still deciding what its true role is – whether it should be lobbying the government for even greater use of OS GIS tools, having a marketing role to organisations, or providing a forum for UK-specific discussion of OS GIS usage.
  • A common theme of the higher-level, application based talks was that the project designers were very impressed with the support they had received from the developers of the underlying tools – with patches often being delivered overnight. This is very encouraging and shows the healthy and active nature of the field.

Overall, I was most impressed with what I saw. There was a great buzz in the room – a diverse range of backgrounds, but everyone enjoying seeing what could be done with Open Source tools. There was perhaps a feeling that we might not be having to use Arc any more in the near future, perhaps?

Nottingham already have next year’s conference date set. Maybe I should do a talk on Mapnik’s capabilities at the next one…

Categories
OpenStreetMap

Testing the OpenStreetMap WordPress Plugin

[osm_map lat=”51.525″ long=”-0.134″ zoom=”17″ type=”Mapnik” width=”500″ height=”300″ marker=”51.525,-0.134″]The Pearson Building, UCL Geography.

Very nice. Hopefully there will soon be an easy way to put a pin on the map using this plugin. [Update: It’s been added – thanks!]