1

I am trying to add this ArcGIS OS Open Background map service in OpenLayers 3.7.0.

http://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Background_2/MapServer

I set the projection and the resolutions for this service in my OL setup like so:

proj4.defs('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');

ol.proj.get("EPSG:27700").setExtent([0, 0, 700000, 1300000]);

var layerOSGBtiles = new ol.layer.Tile({
    source: new ol.source.TileArcGISRest({
        url: 'http://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Background_2/MapServer',
        projection: 'EPSG:27700'
    })
});

var view = new ol.View({
    projection: 'EPSG:27700',
    center: [300000, 500000],
    extent: [0, 0, 700000, 1300000],
    resolutions: [132291.9312505292, 66145.9656252646, 26458.386250105836, 19843.789687579378, 13229.193125052918, 6614.596562526459, 2645.8386250105837, 1322.9193125052918, 661.4596562526459, 264.5838625010584, 132.2919312505292, 66.1459656252646, 26.458386250105836, 19.843789687579378, 13.229193125052918, 6.614596562526459, 2.6458386250105836, 1.3229193125052918, 0.6614596562526459],
    zoom: 6
});

map = new ol.Map({
    target: 'map',
    controls: [],
    layers: [layerOSGBtiles],
    view: view
});

So far I have been unable to get any love from TileArcGISRest. Any help will be welcome.

Here is a JSFiddle which shows the right coordinates and a control geometry for the outline of the British Isles.

1
  • When viewing this service in ArcGIS the requests to the tile server are of them form MapServer/tile/12/551/822 which returns the tile (level, row, column), whereas debugging your jsfiddle OL3 is sending what look more like a WMS GetMap request for each tile. I'd check the constructosr for layerOSGBtiles as it seems OL3 thinks is treating the layer as a WMS?
    – kes
    Sep 2, 2015 at 14:37

1 Answer 1

3

ArcGIS Tiled Map Services can be added using the ol.source.XYZ constructor, dropping this in for layerOSGBTiles does display some tiles. As the OSGB map services use a different tiling scheme this should also be specified using a tileGrid.

var resolutions = [132291.9312505292, 66145.9656252646, 26458.386250105836, 19843.789687579378, 13229.193125052918, 6614.596562526459, 2645.8386250105837, 1322.9193125052918, 661.4596562526459, 264.5838625010584, 132.2919312505292, 66.1459656252646, 26.458386250105836, 19.843789687579378, 13.229193125052918, 6.614596562526459, 2.6458386250105836, 1.3229193125052918, 0.6614596562526459];

var tilegrid = new ol.tilegrid.TileGrid({
    resolutions: resolutions,
    origin: [-5220400,4470200]
})
var layerOSGBtiles = new ol.layer.Tile({
    source: new ol.source.XYZ({
        url: 'http://tiles.arcgis.com/tiles/qHLhLQrcvEnxjtPr/arcgis/rest/services/OS_Open_Background_2/MapServer/tile/{z}/{y}/{x}',
        projection: 'EPSG:27700',
        tileGrid: tilegrid
    })
}); 
4
  • Ok, that's encouraging to see the tiles at least. Not really sure how to add an origin into the schema. I have updated the jsfiddle with your code snippet. Sep 3, 2015 at 16:43
  • Hi Dennis - yes sorry not been able to produce a full example, but I did try with TileGrid so that might help, we had to do something similar with leaflet and proj4js.
    – kes
    Sep 4, 2015 at 13:32
  • Boom. TileGrid did the trick. I updated the jsfiddle which is now working. Thanks a lot. Sep 4, 2015 at 17:41
  • That's great @DennisBauszus - glad you got it working in the end :) I've added your solution to the answer.
    – kes
    Sep 7, 2015 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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