ArcGIS Server 10.3.1 MapServer/export - single layer service = href & multilayer service = imageData (WHY???)

4378
3
04-01-2016 10:16 AM
troyturcott
New Contributor II

ArcGIS Server 10.3.1 MapServer/export => Response for multilayer service returns base64 string in "imageData:blah blah blah". However, response for single layer service returns "href:path to virtual directory/filename.png".

What is going on here?

The documentation indicates that the property "useMapImage=true" which forces the exported image to be written to disk like ArcIMS was deprecated in version 2.0 of the JS API, but I am still seeing images materialize in the "arcgisoutput" directory on the server when calling a single layer MapServer/export.

Does anyone know why behavior is different between single layer and multilayer map service? 

Update - Sorry, I forgot to clarify that the GET/POST call is made to specifically return json using "f=json"...

0 Kudos
3 Replies
deleted-user-RAnWn8DDSd1P
New Contributor III

We're seeing the base64 imageData return for most of our dynamic services on 10.3.1.  Did you discover anything yet?  We got clued in using esri-leaflet where the return has imageData instead of href.

0 Kudos
YohanBienvenue
Occasional Contributor II

I was also trying to use a dynamicMapLayer yesterday with esri-leaflet and couldn't make it work. After digging in the esri-leaflet code I found the function that makes the export request:

  _requestExport: function (params, bounds) {
    if (this.options.f === 'json') {
      this.service.request('export', params, function (error, response) {
        if (error) { return; } // we really can't do anything here but authenticate or requesterror will fire
        this._renderImage(response.href, bounds);
      }, this);
    } else {
      params.f = 'image';
      this._renderImage(this.options.url + 'export' + L.Util.getParamString(params), bounds);
    }
  }

By default, if not specified, esri-leaflet will make the export request with the json format option. As you can see in this code, it will then expect the response to have the href property that points to the image URL. However right now it seems the export response sends the image directly encoded in base64 in the imageData property.

Until this is sorted out, a work-around I found is to tell leaflet to make the request with a non json format. It doesn't matter really, any other format. This will make the export request return the image directly and the leaflet function will load it directly, as seen in the code above.

0 Kudos
GianniContino
New Contributor III

Hi turcot,

I have also experienced the same issue with 10.6 services that answer <imageData> instead of <href>,
but my problem is not related to single or multiple layers, but it happens randomly, I think.
I also noticed that in case of publishing directly from ArcMap 10.6 I have this problem (imageData response);

instead if I create a .sd file and publish it from the web manager then the service returns correctly the href.

Did you find out something about this behaviour?

Thanks,

Gianni

0 Kudos