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:


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.

  • 1
    Why have you created your own custom tile structure rather than reprojecting the original images and tiling into Mercator? – Kelso Sep 10 '10 at 7:06
  • It's probably worth pointing out that OpenStreetMap have done the reprojecting of Streetview for you, should you just want to stay with Mercator all the way through. – Rowland Shaw Sep 10 '10 at 7:53
  • 1
    @Kelso Whilst second guessing, One use case would be that you'd be able to scale accurately. – Rowland Shaw Sep 10 '10 at 7:53
  • 2
    Because I don't want to distort the map. The source data is 1 pixel == 1m and each pixel is a single colour (no anti-aliasing). The os.openstreetmap.org shows the map projected to mercator, and it's – rjmunro Sep 10 '10 at 8:39

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.

| improve this answer | |


(please take a copy rather than hotlinking to the javascript directly)

Working Example with 'Ordnance Survey OpenSpace' Data (Raster Data)

(Select Correct Base Layer)


and View>Source

your likely to need to do some modification to best fit your 250px tiling method (256px was good maths based on experience for OS based web mapping)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.