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)
  • 相关阅读:
    Linux命令之查看cpu个数_核数_内存总数
    Python文件操作大全,随机删除文件夹内的任意文件
    Python文件操作:同一个文件进行内容替换
    异步请求Python库 grequests的应用和与requests库的响应速度的比较
    查询MySQL某字段相同值得重复数据
    /var/redis/run/redis_6379.pid exists, process is already running or crashed的解决办法
    人工智能----TensorFlow开篇简介
    Centos6.5+Python2.7 +ffmpeg+opencv2自动安装脚本
    决策统计---指标六要素
    大数据应用分类
  • 原文地址:https://www.cnblogs.com/adodo1/p/4327914.html
Copyright © 2011-2022 走看看