zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    php中的list()用法中要注意的地方
    怎么让小白理解intel处理器(CPU)的分类
    CPU的历史
    【主板上各种接口和附属部件科普】
    NVMe SSD是什么?
    带你认识SATA、mSATA 、PCIe和M.2四种接口
    那些长短不一的PCI-E插槽都有什么不一样?
    ceph 指定OSD创建pool
    ceph cache pool配置
    搭建ceph集群(单节点)
  • 原文地址:https://www.cnblogs.com/adodo1/p/4327914.html
Copyright © 2011-2022 走看看