<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Replace datasource of a dynamic layer, keep styling in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/replace-datasource-of-a-dynamic-layer-keep-styling/m-p/341115#M1661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use &lt;A href="https://developers.arcgis.com/documentation/common-data-types/layer-source-object.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;dynamic data layers&lt;/A&gt; in ArcGIS Server REST to replace the datasource for a layer in a mapservice when making a request to the &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;/export&lt;/SPAN&gt; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also noticed there is something called a &lt;A href="https://developers.arcgis.com/documentation/common-data-types/layer-source-object.htm#ESRI_SECTION1_C6DFA238BCE0498EB1815955626BD3C3" rel="nofollow noopener noreferrer" target="_blank"&gt;workspaceLayer&lt;/A&gt; 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&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="string token"&gt;"id"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
  &lt;SPAN class="string token"&gt;"source"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"type"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"workspaceLayer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"workspaceId"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEST_WS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"layerId"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"layerfile.lyrx"&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;gives me: 'Unable to create workspaceLayer with invalid 'layerId' input.'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:07:27 GMT</pubDate>
    <dc:creator>BerendVeldkamp</dc:creator>
    <dc:date>2021-12-11T16:07:27Z</dc:date>
    <item>
      <title>Replace datasource of a dynamic layer, keep styling</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/replace-datasource-of-a-dynamic-layer-keep-styling/m-p/341115#M1661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use &lt;A href="https://developers.arcgis.com/documentation/common-data-types/layer-source-object.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;dynamic data layers&lt;/A&gt; in ArcGIS Server REST to replace the datasource for a layer in a mapservice when making a request to the &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;/export&lt;/SPAN&gt; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also noticed there is something called a &lt;A href="https://developers.arcgis.com/documentation/common-data-types/layer-source-object.htm#ESRI_SECTION1_C6DFA238BCE0498EB1815955626BD3C3" rel="nofollow noopener noreferrer" target="_blank"&gt;workspaceLayer&lt;/A&gt; 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&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="string token"&gt;"id"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
  &lt;SPAN class="string token"&gt;"source"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"type"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"workspaceLayer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"workspaceId"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEST_WS"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    &lt;SPAN class="string token"&gt;"layerId"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"layerfile.lyrx"&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;gives me: 'Unable to create workspaceLayer with invalid 'layerId' input.'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:07:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/replace-datasource-of-a-dynamic-layer-keep-styling/m-p/341115#M1661</guid>
      <dc:creator>BerendVeldkamp</dc:creator>
      <dc:date>2021-12-11T16:07:27Z</dc:date>
    </item>
  </channel>
</rss>

