rob-murray / os-leaflet

A Leafletjs TileLayer using Ordnance Survey OpenSpace web map service
http://rob-murray.github.io/os-leaflet/
MIT License
24 stars 8 forks source link

Support multiple tile sizes #1

Open rob-murray opened 10 years ago

rob-murray commented 10 years ago

The web map service from Ordnance Survey returns various products or layers, the tile size in pixels of these can be 200px or 250px - at the moment this layer only supports the products that are at 200px.

We need to support the 250px tile sizes so that all products can be displayed.

Ordnance Survey product list: http://www.ordnancesurvey.co.uk/business-and-government/help-and-support/web-services/os-ondemand/configuring-wmts.html

jopfre commented 5 years ago

It may be possible to have an option to switch between 200px and 250px size tiles with the 250px size tiles just offering three zooms/resolutions [4, 2, 1].

This would avoid the need to switch between tile sizes when zooming and would be a good first step.

I am looking into it at the moment but am fairly new to geo so let me know if you have any suggestions or pointers on how best to implement.

Edit: It is possible. Change resolutions: [2500, 1000, 500, 200, 100, 50, 25, 10, 5, 2.5] to resolutions: [4, 2, 1]

And tileSize: 200 to tileSize: 250

You will also need to ensure the starting zoom is within bounds. Try map.setView(OSHQ.WGS84, 0);

This was good enough for my needs. I could put submit a PR with these settings controlled by a central option if you think it's necessary. Else future folk can follow my steps.

rob-murray commented 5 years ago

Cool, yeah that would be good or just some example code might help anyone else with the same requirements 👍

jopfre commented 5 years ago

Here is the updated OSOpenSpace.js using only 250px mapping layers https://gist.github.com/jopfre/08beb3c369069172066fafcbf4a54ffc