IDL和遥感图像处理分享 http://blog.sciencenet.cn/u/hujianbo ENVI/IDL遥感图像处理算法及应用研究。

博文

ArcEngine中的Statistics类的例子

已有 6534 次阅读 2009-9-5 17:34 |个人分类:生活随感|系统分类:科研笔记

用对于这个类的属性statistics_fields的类型,help里面说的不清楚,写程序时不知道如何下手。用baidu,google搜了半天,居然全世界只能找到这样一个例子,赶紧转帖收藏,免得不见了。

Subject Using ESRI.ArcGIS.AnalysisTools.Statistics 
Author capton siluvairajan 
Date Jun 16, 2008 
Message Hi,
I am trying to use the Geoprocessor -> Analysis Tools -> Statistics Tool from C# and find that the documentation is not helping me.
What are the parameters for the Statistics tool ?

Does anyone have any samples ?

any help would be appreciated.

thanks, 
 
ITable inTbl = clsGDBWorkSpaceManager.openTable("Table1", pws);
ITable outTbl = clsGDBWorkSpaceManager.openTable("Table2", pws);
IField f1 = inTbl.Fields.get_Field(inTbl.FindField("F1"));
IField f2 = inTbl.Fields.get_Field(inTbl.FindField("F2"));     

Geoprocessor GP = new Geoprocessor();

ESRI.ArcGIS.AnalysisTools.Statistics s = new Statistics();

s.in_table = inTbl;
s.out_table = outTbl;
			 

s.case_field = f1;

s.statistics_fields = "Sum.F2";
			
			  

GP.Execute(s, null);
 
  Capton Siluvairajan
GIS Programmer
Cambridge Systematics, Inc.
2457 Care Drive, Suite 101
Tallahassee, FL 32308
csiluvairajan@camsys.com
LinkedIn : http://www.linkedin.com/pub/capton-siluvairajan/9/248/83
 
  untitled.bmp (opens in new window)
 
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Using ESRI.ArcGIS.AnalysisTools.Statistics 
Author Ken Buja 
Date Jun 16, 2008 
Message I agree that the Geoprocessing documentation leaves something to be desired. Usually, I use the Toolbox to create the type of process I intend to code and get the parameters from the dialog box. In the case of Statistics, this is the line that one test executes:

Executing (Statistics_1): Statistics D:DatatestingBujaExport_Output.dbf D:DatatestingBujaExport_Output_Statistics.dbf "HAUL SUM" #

I was getting the Sum of the field Haul, so in your case, try

s.statistics_fields = "F2 Sum"; 
  Ken Buja

National Oceanic and Atmospheric Administration
1305 East-West Highway, N/SCI1
Silver Spring MD 20910-3281
(301) 713-3028 x140
ken.buja@noaa.gov 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Using ESRI.ArcGIS.AnalysisTools.Statistics 
Author capton siluvairajan 
Date Jun 16, 2008 
Message Thanks a lot Ken.

With your suggestion i was able to get it running.

IWorkspace pws = clsGDBWorkSpaceManager.openGDBWorkSpace(clsGDBWorkSpaceManager.GDBType.FileGDB, pth, fileNm, 0);

ITable inTbl = clsGDBWorkSpaceManager.openTable("Table1", pws);
//ITable outTbl = clsGDBWorkSpaceManager.openTable("Table2", pws);
IField f1 = inTbl.Fields.get_Field(inTbl.FindField("F1"));
IField f2 = inTbl.Fields.get_Field(inTbl.FindField("F2"));

Geoprocessor GP = new Geoprocessor();

ESRI.ArcGIS.AnalysisTools.Statistics s = new Statistics();

s.in_table = @"D:FDOTworkQCEW_DataWorkAppsDataq1.gdbTable1";
s.out_table = @"D:FDOTworkQCEW_DataWorkAppsDataq1.gdbTable1_Statistics";

s.case_field = "F1";

s.statistics_fields = "F2 SUM;F3 SUM";
GP.Execute(s, null);

No where in their(ESRI) poor quality documentation, did they mention the input param "object inoutTableName" is actually a string or the field names should be semi colon separated. How are we supposed to know all these ?


anyway thanks for taking the time to help me out.

capton.
 
  Capton Siluvairajan
GIS Programmer
Cambridge Systematics, Inc.
2457 Care Drive, Suite 101
Tallahassee, FL 32308
csiluvairajan@camsys.com
LinkedIn : http://www.linkedin.com/pub/capton-siluvairajan/9/248/83
 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Using ESRI.ArcGIS.AnalysisTools.Statistics 
Author capton siluvairajan 
Date Jun 19, 2008 
Message Ken, can yu please help me with this one also.

I just posted under ArcObjects General section with subject line

"Geoprocessing - Geocoding using c# doesn't work"

if you have time, please take a look at it. thanks in advance for you help.

- capton. 
  Capton Siluvairajan
GIS Programmer
Cambridge Systematics, Inc.
2457 Care Drive, Suite 101
Tallahassee, FL 32308
csiluvairajan@camsys.com
LinkedIn : http://www.linkedin.com/pub/capton-siluvairajan/9/248/83


https://blog.sciencenet.cn/blog-93020-253619.html

上一篇:摆地摊的算无产阶级不?
下一篇:学科建设与学科交叉的一些感想
收藏 IP: .*| 热度|

0

发表评论 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-10-20 01:34

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部