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.
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:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.