Using British Geological Survey Data in Openlayers


Just a quick post to share something that took me hours of frustrated tinkering to figure out.

There are several sets of data available by WMS. Two were of interest to me.

The first was “British geology onshore digital maps (1:50 000 scale)”. I ended up giving up on this one for the time being as it was being incredibly picky about the size and shape of BBOX in the WMS request and returns a white square with no error if not happy. I have not yet found a way to persuade openlayers to give it what it wants.

The second was “UK onshore and offshore bedrock and superficial geology (1:625 000 scale). This one seems a bit more reasonable, although not without problems.

It simply refused to work with a projection of EPSG:900913 which was what my Openlayers map was configured as. Changing to EPSG:27700 made it work, but was incompatible with OpenStreetMap which was my other base layer.

Apparently OpenStreetMap 2.x does not properly support base layers of differing projections and everything hinges on which one gets loaded first. I was able to have one working and the other broken, not very helpful.

Eventually the solution was extremely simple. The projection of EPSG:3857 turns out to be identical to EPSG:900913 and was supported by the server.

Working code snippet below:

var bgslayer = new OpenLayers.Layer.WMS( "British Geological Survey",
"", {layers: 'BGS_EN_Bedrock_and_Superficial_Geology', CRS: 'EPSG:3857', version: '1.3.0'}, {projection: 'EPSG:3857'} );

Enjoy. If I ever get the detailed map working, I’ll share here. Do let me know if you do (BBOX strategy parameters look interesting).

UPDATE: The hydrogeological map also works with these parameters. URL is and layer name is Hydrogeology.


Leave a Reply