Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for https://osdatahub.os.uk/ (has free tier) #29

Open
saturdaywalkers opened this issue Apr 30, 2020 · 5 comments
Open

add support for https://osdatahub.os.uk/ (has free tier) #29

saturdaywalkers opened this issue Apr 30, 2020 · 5 comments

Comments

@saturdaywalkers
Copy link

miracles can happen!

well, maybe

https://osdatahub.os.uk/ now has a free tier

it just doesn't give an example of what the tile sets look like,
and if they include the 1:25 & 1:50 mapping

it supports osgb and web-mercator projections ... but not for all tile sets

Road | EPSG:27700 | Road_27700 | EPSG:27700
Road | EPSG:3857 | Road_3857 | EPSG:3857
Outdoor | EPSG:27700 | Outdoor_27700 | EPSG:27700
Outdoor | EPSG:3857 | Outdoor_3857 | EPSG:3857
Light | EPSG:27700 | Light_27700 | EPSG:27700
Light | EPSG:3857 | Light_3857 | EPSG:3857
Leisure | EPSG:27700 | Leisure_27700 | EPSG:27700

I've checked 'outdoor'. No footpaths.

The 'leisure' tile set is in osgb only, so i cant check it

This might help for use with leaflet
'https://osdatahubapi.os.uk/OSMapsAPI/wmts/v1?key=API_KEY&service=WMTS&request=GetTile&outputformat=image/png'
+ 'style=default&layer=Outdoor_3857&tileMatrixSet=EPSG:3857&tileMatrix={z}&tileRow={y}&tileCol={x}'

please could you see if its worth supporting...

andrew

@saturdaywalkers saturdaywalkers changed the title add support for https://osdatahub.os.uk/ add support for https://osdatahub.os.uk/ (has free tier) Apr 30, 2020
@saturdaywalkers
Copy link
Author

@rob-murray Just to clarify, the 3 x '3857' tile layers can be used direct in leaflet with a wms plugin. It's the 'Leisure_27700' layer (with no matching 3857 equivalent) that I curious about. I'm hoping "os-leaflet" can be repurposed to access it, and further hoping its the same mapping as openspace is/was.

@rob-murray
Copy link
Owner

Thanks - I have not kept up to date with OS web mapping API offerings, but will try and have a look at these and see if they can be integrated. Ideally OS APIs should just work with Leaflet much easier

@saturdaywalkers
Copy link
Author

Well. A miracle has happened. Hopefully.

"osdatahub" is now live. it contains an example of: leaflet + OS mapping + OSGB projection
https://labs.os.uk/public/os-data-hub-examples/os-maps-api/zxy-27700-basic-map

(so, unlike Bing, no OS mapping with an web-mercator projection - the only bad point)

The example is quite simple - and also uses proj4js, and proj4leaflet :)

There's a £1,000 per month worth of map tiles "free" tier - which they say works out to quite a lot.

From what I understand, 1:200K ("road atlas scale") and above tiles are zero rated.

Andrew

@saturdaywalkers
Copy link
Author

saturdaywalkers commented Jul 3, 2020

// need leaflet, proj4js, proj4leaflet libs
// need lat, lon, zoom, os data hub api key
let key = 'your key', url_base = 'https://api.os.uk/maps/raster/v1/zxy';
let crs = new L.Proj.CRS( 
  'EPSG:27700',
  '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs',
  { resolutions: [ 896.0, 448.0, 224.0, 112.0, 56.0, 28.0, 14.0, 7.0, 3.5, 1.75 ], origin: [ -238375.0, 1376256.0 ] }
  );

let os_gb_tile_layer = L.tileLayer( `${ url_base }/Leisure_27700/{z}/{x}/{y}.png?key=${ key }` );
let map = new L.Map(  "dom_id", { 
  center: [lat, lon], 
  crs: crs,
 minZoom: 0, maxZoom: 9,
 zoom: zoom - 7, // correction from os gb layer no. to web mercator layer no, floor=0, ceiling=9
 'layers'	: [ os_gb_tile_layer ],
  } );

@rob-murray
Copy link
Owner

rob-murray commented Jul 4, 2020

Thanks 👍
I've only had a quick look so far but those examples with the new map tile API are so simple this library isnt needed anymore. I created this because it was a pain and needed a bit of code to get it working with OS OpenSpace but if that service is replaced with this better zxy API then it would be better to use that - providing you can pay the cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants