2

In Openlayers v2 I could get a map from an ESRI server that was not a cached service using code similar to below

var arcims = new OpenLayers.Layer.ArcGIS93Rest("MyName",
    "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/export",
    {
        layers: "0,1,2"
    });

How do you do the same using Openlayers v3 I can't same to find the right function in ol.source

2

The ArcGIS REST API hasn't been included in the OpenLayers 3 code yet. People are discussing its importance and it is expected to have an implementation in a later version. Until then, you can try to stack with an ArcGIS WMS server or use OpenLayers 2.

OpenLayers 3 WMS example: http://jsfiddle.net/GFarkas/tr0s6uno/

Code:

map = new ol.Map({
    target: 'map',
    layers: [
    new ol.layer.Tile({
        source: new ol.source.TileWMS({ 
            url: "http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StateCityHighway_USA/MapServer/WMSServer",
            params:{
                LAYERS:"0,1,2",
                FORMAT:"image/png",
            }
         })
    })],
    view: new ol.View({
        center: [-115, 45],
        zoom: 0
    })
});
|improve this answer|||||
0

OpenLayers-3.9.0 adds support for ArcGIS Rest Services via the ol.source.TileArcGISRest (source pull request). TileArcGISRest Example

OpenLayers-3.16.0 introduced ol.source.ImageArcGISRest to serve a single static image (source pull request). ImageArcGisRest Example

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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