[GIS] Using openlayers to render UK National Grid maps

dataopenlayers-2ordnance-surveyunited-kingdom

Is there a way I can use Openlayers with a 1 pixel = 1m/2m/4m OS Grid map at high resolutions (i.e. OS Street View), but switching to a Mercator projection when you zoom out (i.e. for Google Maps or OSM), but have markers and/or vector overlays reprojected with the change of zoom?

As OS grid and OS Street view is based on powers of powers of 10, I've split it into 250 pixel tiles, rather than the 256 pixels used for most web maps. I have a folder structure like:

xy/xy/xy/xy-z.png

where each folder is a power of 10 grid square, i.e. each xy represents hundreds of km, tens of km, km, and position within the 1km square respectively.

There are 4 zoom levels in the bottom folder, 1 being the whole 1km square, 2 is 4 500m squares and 4 is 16 250m squares.

Best Answer

There is no way in OpenLayers to have vector data transform or reproject after a chance in base layer built into the library. OpenLayers Ticket #1249 is related to this, and this is one of the areas that we expect to improve in OpenLayers 3.0.

In the mean time, if you want this functionality, registering for a changebaselayer event and doing what you need to with that -- reprojecting the data, or whatever else makes sense -- is what you will need to do if you want to change the projection of your base layer / map.

Related Question