Skip to main content

using json string in "set layer definition"

Comments

7 comments

  • Permanently deleted user

    I can't tell what you've already tried from the post^ however the first thing I would do is put it in an entire string and change the double quotes to single...so

    "{'id':101,'source':{'type':'mapLayer','mapLayerId':1,'gdbVersion':'jnighber_20131106012036'}}"

    ....the integer values might have to be in single quotes too ( hopfully not )

    0
  • Permanently deleted user

    Thank you for your response,

    I will try this and also quoting the numbers and let you know soon.

    Jeff

     

     

    0
  • Permanently deleted user

    hi--

    neither of these worked in the workflow or in the manager:

    "{'id':101,'source':{'type':'mapLayer','mapLayerId':1,'gdbVersion':'jnighber_20131106012036'}}"

    "{'id':'101','source':{'type':'mapLayer','mapLayerId':' 1','gdbVersion':'jnighber_20131106012036'}}"

     

    this one worked in manager using the dynamic layer definition wizard for the layer, did not work in a workflow using the setlayerdefinition activity

    {"id":101,"source":{"type":"mapLayer","mapLayerId":1,"gdbVersion":"jnighber_20131106012036"}}

     

    i

     

    in the simulator the program runs without error

    and in the site the workflow runs without error.

    in the viewer it runs without error or results, so its not really working as expected.

    here is my workflow

    <Activity mc:Ignorable="sap" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="322,829" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client" xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client" xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client" xmlns:esri="http://schemas.esri.com/arcgis/client/2009" xmlns:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core" xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi" xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;assembly=Geocortex.EssentialsWpfApi" xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting" xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow" xmlns:gwa1="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow.Activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=System.Core" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=mscorlib" xmlns:s3="clr-namespace:System;assembly=System.Drawing.Design" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:s5="clr-namespace:System;assembly=System.Design" xmlns:s6="clr-namespace:System;assembly=System.Web.Services" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

     

      <Sequence sap:VirtualizedContainerService.HintSize="282,789" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">

     

        <Sequence.Variables>

     

          <Variable x:TypeArguments="x:String" Name="version" />

     

          <Variable x:TypeArguments="x:String" Name="mapservice" />

     

          <Variable x:TypeArguments="esri:FeatureSet" Name="featureSet1" />

     

        </Sequence.Variables>

     

        <sap:WorkflowViewStateService.ViewState>

     

          <scg:Dictionary x:TypeArguments="x:String, x:Object">

     

            <x:Boolean x:Key="IsExpanded">True</x:Boolean>

     

          </scg:Dictionary>

     

        </sap:WorkflowViewStateService.ViewState>

     

        <Assign sap:VirtualizedContainerService.HintSize="260,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="x:String">[version]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="x:String">jnighber_20131106012036</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <gwa1:Alert sap:VirtualizedContainerService.HintSize="260,82" Text="[&quot;{&quot;&quot;id&quot;&quot;:101,&quot;&quot;source&quot;&quot;:{&quot;&quot;type&quot;&quot;:&quot;&quot;mapLayer&quot;&quot;,&quot;&quot;mapLayerId&quot;&quot;:1,&quot;&quot;gdbVersion&quot;&quot;:&quot;&quot;&quot; &amp; version &amp; &quot;&quot;&quot;}}&quot;]" />

     

        <gwa1:SetLayerDefinition Definition="[&quot;{&quot;&quot;id&quot;&quot;:101,&quot;&quot;source&quot;&quot;:{&quot;&quot;type&quot;&quot;:&quot;&quot;mapLayer&quot;&quot;,&quot;&quot;mapLayerId&quot;&quot;:1,&quot;&quot;gdbVersion&quot;&quot;:&quot;&quot;&quot; &amp; version &amp; &quot;&quot;&quot;}}&quot;]" sap:VirtualizedContainerService.HintSize="260,128" LayerId="1" MapServiceId="16" />

     

        <Assign sap:VirtualizedContainerService.HintSize="260,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="x:String">[mapservice]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="x:String">["http://ilmorso3gi7vm/arcgis/rest/services/NISIMS/NISIMS_Editing_Inf_Trtmnts_OSO/MapServer"]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <gwa1:RefreshMap sap:VirtualizedContainerService.HintSize="260,59" MapServiceId="16" />

     

      </Sequence>

     

    </Activity>

     

     

     

     

     

    0
  • Ryan Cooney

    Hi Jeff,

    There is some confusion here between the terms "Layer Definition" and "Dynamic Layer Definition".

    A "Layer Definition" is just a where clause that can be applied to an existing layer. Something like: "POPULATION > 100000". The Set Layer Definition activity just applies the where clause to a single layer.

    A "Dynamic Layer Definition" is the entire definition of a layer including the data source, symbology, labels, where clause... everything. The JSON that you are trying to apply is a Dynamic Layer Definition. There isn't an activity that will set the dynamic layer definition of a layer.

    --Ryan

    0
  • Permanently deleted user

    Hi Ryan,

    Is the previous statement still true regarding not being able to set this from a workflow?

    I was able to use a sequence of 'get' -> 'set' -> 'get' layer property on the "dynamicDefinition" property.  In doing so I could see the original definition JSON, set the definition to my new JSON string and then read that back (and it had my new string).  However it appeared to have no affect on the map layer in my HTML 5 viewer.  I tested the JSON strings out in the Manager before trying to set with a workflow and they appeared to be valid.

    My JSON string defined the layer with a join to a table with a def query expression in it.  The idea being that I have a one-many relationship in the raw data (feature class to data table) but I want to be able to swap out the def query (to always achieve a 1-1 relationship) and rendererer so that I can see different data rendered on the same layer.  The fields would not change and the number of features would not change, just the values I'm renderering on.

    thanks

    0
  • Luuk Schaminée
    Did anybody get this working. I want to accomplish the same, I want to change the styling of a maplayer through a workflow.

     

    I am using the HML5 viewer version 2.6.1.0166 and Essentials 4.5 (4.0.5)

     

    Hope that someone can help.

     

    Regards,

     

    Luuk
    0
  • Permanently deleted user
    Hi Luuk,

     

    The Update Graphics Layer activity can be used to change the styling of a graphics layer added to the viewer, and you may specify a JSON string to create a renderer for this activity.  However, I am not sure if there is a method to update the layer definition to set its draw order from workflow.

     

    There's an Idea in our Ideas section to get the renderer from the graphics layers - feel free to post a new Idea describing your use case and we can consider it!

     

    Regards,

     

    -Malcolm
    0

Please sign in to leave a comment.