1
votes

I am using openlayers v3.11.2 and have been having trouble attempting to load this service: https://gis7.nsgc.gov.ns.ca/arcgis/rest/services/BASE/NSTDB_10k_Utilities_WebMercator_WGS84/MapServer

I have layers working that are loaded by json using this code

function loadJSON(ID, URL) {
            var newLayer = new ol.layer.Tile({
                id: ID,
                source: new ol.source.TileJSON({
                    url: URL,
                    crossOrigin: 'anonymous'
                })
            });
            map.addLayer(newLayer);
        }

If i try putting the above url in it doesn't work. I also tried using the example off the openlayers website "esri ArcGIS REST Feature Service example" located here but couldn't get it working with the above url either. http://openlayers.org/en/v3.11.2/examples/vector-esri.html?q=esri

If someone could give me a working example or point me in the right direction it would be appreciated.

1

1 Answers

2
votes

Checkout the ole library that provides integration between OpenLayers 3 and Esri services: https://github.com/boundlessgeo/ole

I was able to simply add your MapServer in the layer-generator example:

enter image description here