determine geometry type
I'm creating a generic worflow against several layers in a map services.
How can I test for geometry type (point, line, polyon) for a layer in a map service?
Layer 1 Is it a point or Area or Line?
Depending on the geometrytype...different calculations will occur.
-
Hi Ken,
Reading map service info in JSON format might help. Use DownloadString to get JSON text and JsonToDictionary to retrieve geometry type info. Please see below.
Chen-Ting
<Activity mc:Ignorable="sap sap2010 sads" x:Class="{x:Null}" mva:VisualBasic.Settings="{x:Null}" sap2010:WorkflowViewState.IdRef="ActivityBuilder_1"
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: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:sa="clr-namespace:System.Activities;assembly=System.Activities"
xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
xmlns:sl="clr-namespace:System.Linq;assembly=System.Core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextExpression.NamespacesForImplementation>
<sco:Collection x:TypeArguments="x:String">
<x:String>System.Activities</x:String>
<x:String>System.Activities.XamlIntegration</x:String>
<x:String>System.Activities.Statements</x:String>
<x:String>System.Activities.Expressions</x:String>
<x:String>System.Activities.Validation</x:String>
<x:String>ESRI.ArcGIS.Client</x:String>
<x:String>ESRI.ArcGIS.Client.Geometry</x:String>
<x:String>ESRI.ArcGIS.Client.Tasks</x:String>
<x:String>Geocortex.Core.Extensions</x:String>
<x:String>Geocortex.Workflow.Activities</x:String>
<x:String>Geocortex.Forms.Client</x:String>
<x:String>Geocortex.Forms.Client.Items</x:String>
<x:String>Geocortex.Reporting</x:String>
<x:String>System</x:String>
<x:String>Microsoft.VisualBasic.Activities</x:String>
<x:String>System.Collections.Generic</x:String>
<x:String>System.Linq</x:String>
<x:String>System.Windows.Markup</x:String>
</sco:Collection>
</TextExpression.NamespacesForImplementation>
<TextExpression.ReferencesForImplementation>
<sco:Collection x:TypeArguments="AssemblyReference">
<AssemblyReference>System.Activities</AssemblyReference>
<AssemblyReference>ESRI.ArcGIS.Client</AssemblyReference>
<AssemblyReference>Geocortex.Core</AssemblyReference>
<AssemblyReference>Geocortex.Workflow</AssemblyReference>
<AssemblyReference>Geocortex.EssentialsWpfApi</AssemblyReference>
<AssemblyReference>Geocortex.Reporting</AssemblyReference>
<AssemblyReference>System.Core</AssemblyReference>
<AssemblyReference>System</AssemblyReference>
<AssemblyReference>mscorlib</AssemblyReference>
<AssemblyReference>PresentationFramework</AssemblyReference>
<AssemblyReference>WindowsBase</AssemblyReference>
<AssemblyReference>PresentationCore</AssemblyReference>
<AssemblyReference>System.Xaml</AssemblyReference>
</sco:Collection>
</TextExpression.ReferencesForImplementation>
<Sequence sap2010:WorkflowViewState.IdRef="Sequence_1" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<Sequence.Variables>
<Variable x:TypeArguments="scg:IDictionary(x:String, x:Object)" Name="iDictionary1" />
<Variable x:TypeArguments="x:String" Name="string1" />
</Sequence.Variables>
<gwa1:DownloadString sap2010:WorkflowViewState.IdRef="DownloadString_1" Result="[string1]" Uri="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0?f=pjson" />
<gwa1:JsonToDictionary sap2010:WorkflowViewState.IdRef="JsonToDictionary_1" Json="[string1]" Result="[iDictionary1]" />
<gwa1:Alert sap2010:WorkflowViewState.IdRef="Alert_1" Title="[iDictionary1("geometryType").toString]" />
<sads:DebugSymbol.Symbol>dyJDOlxVc2Vyc1xjdHdhbmdcRGVza3RvcFxKU09OMi54YW1sCUADSQ4CAQFFBUW+AQIBCkYFRnwCAQVHBUd3AgECRVRFXwIBDEVkRbsBAgELRmlGeQIBCEZWRmECAQZHQUd0AgED</sads:DebugSymbol.Symbol>
</Sequence>
<sap2010:WorkflowViewState.ViewStateManager>
<sap2010:ViewStateManager>
<sap2010:ViewStateData Id="DownloadString_1" sap:VirtualizedContainerService.HintSize="313,92" />
<sap2010:ViewStateData Id="JsonToDictionary_1" sap:VirtualizedContainerService.HintSize="313,92" />
<sap2010:ViewStateData Id="Alert_1" sap:VirtualizedContainerService.HintSize="313,92" />
<sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="335,480">
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</sap2010:ViewStateData>
<sap2010:ViewStateData Id="ActivityBuilder_1" sap:VirtualizedContainerService.HintSize="375,560" />
</sap2010:ViewStateManager>
</sap2010:WorkflowViewState.ViewStateManager>
</Activity>0 -
<FeatureSet>.GeometryType.ToString
That way you can use an IF statement to test for a specific GeometryType. Point/Polyline/Polygon.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare