ArcGIS 文件地理数据库的表记录添加、删除

//获得工作空间,打开要素类、表(Util类)

public class BtsUtils
{
 public static String tinPath;
 
 public static IFeatureWorkspace featureWorkspace;
 
 public static ITable baseTable;
 
 public static ISpatialReference spatialReference;
 /**
  *
  * @param path "E:\\eclipse\\workspace\\Debug\\gis.gdb";(文件地理数据库)
  * @return
  * @throws UnknownHostException
  * @throws IOException
  */
 public static IFeatureWorkspace getWorkspace(String path) throws UnknownHostException, IOException
 {
        IWorkspaceFactory factory = new FileGDBWorkspaceFactory();
        IWorkspace workspace = factory.openFromFile(path, 0);
        featureWorkspace = new IFeatureWorkspaceProxy(workspace);
//        featureWorkspace = (IFeatureWorkspace)workspace;
        return featureWorkspace;
 }
 /**
  *
  * @param name
  * @return
  * @throws AutomationException
  * @throws IOException
  */
 public static IFeatureClass openFeatureClass(String name) throws AutomationException, IOException
 {
  IFeatureClass fc = featureWorkspace.openFeatureClass(name);
  spatialReference = new IGeoDatasetProxy(fc).getSpatialReference();
  return fc;
 }
 
 /**
  *
  * @param tableName
  * @return
  * @throws AutomationException
  * @throws IOException
  */
 public static ITable openTable(String tableName) throws AutomationException, IOException
 {
  baseTable = featureWorkspace.openTable(tableName);
  return baseTable;
 }
 
}

 

 

//for eg:tableName = 小区数据表

ITable itable = BtsUtils.openTable(tableName);

itable.deleteSearchedRows(null);//删除表中所有数据

 

//向表添加一行数据

IRow row = itable.createRow();

row.setValue(itable.findField("cellId"), cell.getObjectId());

row.store();

 itable.insert(true);



新店开张,0利润销售,只为挣信誉,欢迎大家选购,还可以代充话费!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值