Replace datasource of a dynamic layer, keep styling

384
0
12-06-2019 12:29 AM
BerendVeldkamp
Occasional Contributor II

Hi,

I'm trying to use dynamic data layers in ArcGIS Server REST to replace the datasource for a layer in a mapservice when making a request to the /export method. What happens is that for certain users, instead of the original featureclass, a view is used in order to limit what they see on the map. This already works.

However, when using a dataLayer object, I'm forced to also provide a drawingInfo object that specifies the symbology. But this particular mapservice uses some complicated symbols that cannot be reproduced by the renderer in the drawingInfo.

I was wondering if there is a way to tell ArcGIS Server to use the renderer from an existing mapLayer in the service, and only replace the datasource being used.

I also noticed there is something called a workspaceLayer that can be used when the service is published by ArcGIS Pro, and which references a .lyrx file. So far I haven't been able to get the proper syntax. For example, setting dynamicLayers to

[ {
  "id": 1,
  "source": {
    "type": "workspaceLayer",
    "workspaceId": "TEST_WS",
    "layerId": "layerfile.lyrx"
  }‍‍‍‍‍‍‍‍‍‍
} ]‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

gives me: 'Unable to create workspaceLayer with invalid 'layerId' input.'

0 Replies