AnsweredAssumed Answered

Trying to use ArcGISDynamicMapServiceLayer to display RasterDataSource

Question asked by myESRIUName on Jun 22, 2016
Latest reply on Dec 1, 2016 by s.offermannconterra-de-esridist

Using ESRI JSAPI 3.16 and ArcGIS Server 10.4, I'm trying to work out how to display a user-specified TIF using a dynamic workspace associated with a ArcGISDynamicMapServiceLayer. So far, no luck. When I look at the REST request that is being submitted when I add my defined layer to the map, none of the dynamic information is being passed along so I end up with a blank image returned.

 

 

I've tried various convolutions of JavaScript code to do this. At the moment, my code is like this:

        var rasterDataSource = new RasterDataSource();

        rasterDataSource.workspaceId = "rasters";

        rasterDataSource.dataSourceName = "cr_rc.tif";

 

        var layerDataSource = new LayerDataSource();

        layerDataSource.dataSource = rasterDataSource;

        layerDataSource.type = "raster"

 

        var dynamicLayerInfo = new DynamicLayerInfo();

        dynamicLayerInfo.source = layerDataSource;

 

        var rasterLayer = new ArcGISDynamicMapServiceLayer(

            "http://<domain>/arcgis/rest/services/dynWS/MapServer"

            ,{

                dynamicLayerInfos:[

                    dynamicLayerInfo

                ]

            }

        );

        map.addLayer(rasterLayer);

     

The export request that is sent by the map.addLayer functionality is:

 

http://<domain>/arcgis/rest/services/dynWS/MapServer/export?dpi=96&transparent=true&format=png8&bbox=-14468865.117896732,3183946.947948264,-5594831.882103268,10296871.052051734&bboxSR=3857&imageSR=3857&size=907,727&f=image

 

Now, I can get the image I want with an export request that looks like this (decoded here, of course):

 

http://<domain>/arcgis/rest/services/dynWS/MapServer/export?dpi=96&transparent=true&format=png8&bbox=-14468865.117896732,3183946.947948264,-5594831.882103268,10296871.052051734&bboxSR=3857&imageSR=3857&size=907,727&f=image&dynamicLayers=[

{

  "source":{

    "type": "dataLayer",

    "dataSource": {

      "type": "raster",

      "workspaceId":"rasters",

      "dataSourceName": "cr_rc.tif"

    }

  }

}

]

 

I just can't figure out how to get the JSAPI to tack on the dynamicLayers parameter to its export request. At least, I think that's my only problem.

 

Can anyone provide any suggestions regarding what I am missing or doing incorrectly here?

 

Cheers,

jtm

Outcomes