Skip to main content

Dynamically update map layer based on query on a field

Comments

7 comments

  • Permanently deleted user

    Hi Alex,

    In Geocortex Essentials 3.7 (and 3.8!) there is a "Set Layer Definition" Workflow activity which should meet your need.  You need to provide the map service ID, Layer Name and Definition (which is a where clause just like you would use in the Query activity) and the features will be filtered in the map.

    John

    0
  • Permanently deleted user

    Alex,

    I should also mention that if there is no possibility of using Essentials 3.7, you would need to have a custom Silverlight workflow handler to filter features.  It's still possible in the Esri API, it just is not exposed via Workflow until 3.7.

    John

    0
  • Permanently deleted user

    Thanks John!

    Our organization has made purchase for Geocortex 3.7. I think we will be looking to get the feature filter work when it is deployed.

    Alex

    0
  • Permanently deleted user

    Hi John and Alex

    I have just been having a test of this and it works quite nicely.

    The only piece that I have an issue with that would keep it flexible is the need to manually find what the Map Service Id is that the layer in question is in.

    GetMapServiceInfo is a huge improvement compared to having to manually keep track of Layer Ids but we almost need a GetSiteInfo Activity so that some of the details of the site are able to be retrieved without having to do some custom coding to talk to the Essentials Site REST endpoint. As far as I can see there is no Activity (currently) that does this.

    If it brought back/created a SiteInfo object with lists of Map Services and so that could be iterated through then that would be great.

    You could DownloadString from http://gisagsdev.rdc.govt.nz/Geocortex/Essentials/REST/sites/Airport_Obstacle_Limitation_Surface_Checker/map?f=pjson but how do you know that URL for any given site in a manner that fits a Spatial Application Infrastructure and the implied modularity of having one?

    Potentially I could pass that string of json off to another process/workflow to parse and get the id for a given displayName.

    Any thoughts on a better way to do this would be appreciated

    Regards

    Ralph Price

    Rotorua

    New Zealand

    0
  • Permanently deleted user

    Any chance someone could post a video on this?  

    0
  • Permanently deleted user

    Hi Kenneth

    here is the workflow that I hooked up to a menu item in the 'I want to' menu:

    <Activity mc:Ignorable="sap" x:Class="{x:Null}" 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:gfc="clr-namespace:Geocortex.Forms.Client;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:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mv1="clr-namespace:Microsoft.VisualBasic;assembly=Microsoft.VisualBasic" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:mvc="clr-namespace:Microsoft.VisualBasic.CompilerServices;assembly=Microsoft.VisualBasic" 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.Numerics" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" 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:x="http://schemas.microsoft.com/winfx/2006/xaml">

     

      <x:Members>

     

        <x:Property Name="parcelMapService" Type="InArgument(x:String)" />

     

      </x:Members>

     

      <sap:VirtualizedContainerService.HintSize>567,1309</sap:VirtualizedContainerService.HintSize>

     

      <mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>

     

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

     

        <Sequence.Variables>

     

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

     

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

     

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

     

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

     

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

     

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

     

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

     

        </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>

     

        <gwa1:DownloadString sap:VirtualizedContainerService.HintSize="505,82" Result="[theRESTEndpoint]" Uri="http://gisagsdev.rdc.govt.nz/Geocortex/Essentials/REST/sites/Airport_Obstacle_Limitation_Surface_Checker/map?f=pjson" />

     

        <gwa1:Alert sap:VirtualizedContainerService.HintSize="505,82" Text="[theRESTEndpoint]" />

     

        <gwa1:GetMapServiceInfo sap:VirtualizedContainerService.HintSize="505,128" LayerId="[theLayerId]" LayerName="V_ASS_LABELS_POLY" MapServiceId="3" MapServiceUrl="[theMapServiceUrl]" />

     

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

     

          <Assign.To>

     

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

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="x:String">[theMapServiceUrl &amp; "/" &amp; theLayerId]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <gwa1:Prompt DefaultText="06500" sap:VirtualizedContainerService.HintSize="505,128" Result="[theSue]" Title="What Roll?" />

     

        <If Condition="[theSue &lt;&gt; String.Empty]" sap:VirtualizedContainerService.HintSize="505,201">

     

          <If.Then>

     

            <Assign sap:VirtualizedContainerService.HintSize="240,100">

     

              <Assign.To>

     

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

     

              </Assign.To>

     

              <Assign.Value>

     

                <InArgument x:TypeArguments="x:String" xml:space="preserve">["Roll = " &amp; chr(39) &amp;  theSue &amp; chr(39)]</InArgument>

     

              </Assign.Value>

     

            </Assign>

     

          </If.Then>

     

          <If.Else>

     

            <Assign sap:VirtualizedContainerService.HintSize="240,100">

     

              <Assign.To>

     

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

     

              </Assign.To>

     

              <Assign.Value>

     

                <InArgument x:TypeArguments="x:String" xml:space="preserve">["Roll like " &amp; chr(39) &amp;  "%" &amp; chr(39)]</InArgument>

     

              </Assign.Value>

     

            </Assign>

     

          </If.Else>

     

        </If>

     

        <gwa1:SetLayerDefinition Definition="[theDefStr]" sap:VirtualizedContainerService.HintSize="505,128" LayerId="[theLayerId]" MapServiceId="3" />

     

        <gwa1:RefreshMap sap:VirtualizedContainerService.HintSize="505,59" />

     

      </Sequence>

     

    </Activity>

     

    Points to note:

    • The first two activities were more for my interest as to how the GE REST endpoint shows the map service id's (as required for ' GetMapServiceInfo' )
    • V_ASS_LABELS_POLY is the layer that I wish to allow the user to filter on
    • the user is prompted on the value to filter on (ideally this could be changed to only be a list of valid items)
    • theDefStr is populated with the right phrasing for a standard arcmap definition query ie Roll = '06500'  or Roll like '%' depending on whether the user inputed an empty string so as to return all features. Again not ideal
    • SetLayerDefinition uses theDefStr to filter the layer
    • RefreshMap initiates a refresh of the map so that the filtered layer is redisplayed correctly.

     

    Hope that helps

    Ralph Price

    Rotorua

    New Zealand

    0
  • Permanently deleted user

    Thx Ralph for posting the example.  This will come in very handy.

    Anyone have any more examples using the setLayerDefinition tool? maybe changing the color of the feature set, or using combo boxes with this tool?

     

    0

Please sign in to leave a comment.