• How to use value tables


    http://resources.esri.com/help/9.3/arcgisengine/dotnet/84349562-e062-44ee-8db0-9fcdcd64708b.htm   Using value tables A value table is a flexible object that can be used as input for a multivalue parameter. Examples of multivalue parameter values focus on the text value of the parameter that may become difficult to use when there are numerous values with complex paths. The value table is used to organize the values into a table so values can be easily added or removed, eliminating the complexity of parsing a multivalue text string. The table can be thought of as a virtual matrix of values that is not persisted as an actual table because it is a device for managing many values in a program.  A value table can contain many columns. Each column corresponds to a value in the parameter being defined. Intersect, for example, requires the path to a dataset or a layer name and an optional priority rank for each input entry. A value table for Intersect will require two columns, one for the data and one for the priority rank. The following code example shows how to create and populate a value table for Union. In this example, you need to add a reference to the ESRI.ArcGIS.Geoprocessing assembly to have access to GPValueTableObjectclass.  AddRow's row argument is space delimited. Any value used in the row argument that contains spaces must be enclosed in quotation marks. In the following example, a value table with two columns has a feature class and an index value added; for example, vt.AddRow("'c:/temp/land use.shp' 2"): [C#] using ESRI.ArcGIS.Geoprocessor;using ESRI.ArcGIS.Geoprocessing;using ESRI.ArcGIS.esriSystem;public void ExampleUsingValueTables(Geoprocessor GP){ // Create a value table with two columns. IGpValueTableObject vtobject = new GpValueTableObjectClass(); vtobject.SetColumns(2); // Iterate the enumeration of feature classes and add them to the value table. // In this case, the inputs and ranks are being set for Intersect. GP.SetEnvironmentValue("workspace", @"C:\GP\PortlandOR.gdb"); IGpEnumList fcColl = GP.ListFeatureClasses("*", "POLYLINE", ""); string inputfeatures = fcColl.Next(); object row = ""; while (inputfeatures != "") { if (inputfeatures == "streets") { row = inputfeatures + " 1"; vtobject.AddRow(ref row); } else { row = inputfeatures + " 2"; vtobject.AddRow(ref row); } inputfeatures = fcColl.Next(); } IVariantArray pVarArray = new VarArrayClass(); pVarArray.Add(vtobject); pVarArray.Add("C:\\Gp\\PortlandOR.gdb\\streets_bike"); // Execute the Intersect tool. GP.Execute("intersect_analysis", pVarArray, null);} [VB.NET] Imports ESRI.ArcGIS.GeoprocessorImports ESRI.ArcGIS.esriSystemPublic Sub ExampleUsingValueTables(ByVal GP As Geoprocessor) ' Create a value table with two columns. Dim vtobject As ESRI.ArcGIS.Geoprocessing.IGpValueTableObject = New ESRI.ArcGIS.Geoprocessing.GpValueTableObjectClass() vtobject.SetColumns(2) ' Iterate the enumeration of feature classes and add them to the value table. ' In this case, the inputs and ranks are being set for Intersect. GP.SetEnvironmentValue("workspace", "C:\GP\PortlandOR.gdb") Dim fcColl As ESRI.ArcGIS.Geoprocessing.IGpEnumList = GP.ListFeatureClasses("*", "POLYLINE", "") Dim inputfeatures As String = fcColl.Next() Dim row As Object = "" Do While inputfeatures <> "" If inputfeatures = "streets" Then row = inputfeatures & " 1" vtobject.AddRow(row) Else row = inputfeatures & " 2" vtobject.AddRow(row) End If inputfeatures = fcColl.Next() Loop Dim pVarArray As IVariantArray = New VarArrayClass() pVarArray.Add(vtobject) pVarArray.Add("C:\Gp\PortlandOR.gdb\streets_bike") ' Execute the Intersect tool. GP.Execute("intersect_analysis", pVarArray, Nothing) End SubThe following example shows how a value table can be populated with a multivalue string that has been passed to a script as an argument, making it easy to extract each record: [C#] IGpValueTableObject vtobject = new GpValueTableObjectClass();// Where input features is a multivalue of input feature classes.vtobject.LoadFromString(inputfeatures); [VB.NET] Dim vtobject As ESRI.ArcGIS.Geoprocessing.IGpValueTableObject = New ESRI.ArcGIS.Geoprocessing.GpValueTableObjectClass()' Where input features is a multivalue of input feature classes.vtobject.LoadFromString(inputfeatures)
  • 相关阅读:
    vue学习笔记 样式 class style(五)
    vue学习笔记 计算属性(四)
    vue学习笔记 模板语法(三)
    vue学习笔记 实例(二)
    vue学习笔记 概述(一)
    Babel指南——基本环境搭建
    手动es6编译es5(命令行)
    TrimPath
    git 远程仓库管理
    CSS左侧固定宽 右侧自适应(兼容所有浏览器)
  • 原文地址:https://www.cnblogs.com/adodo1/p/4327914.html
Copyright © 2020-2023  润新知