對ArcGis Engine的增 刪 改實現

2022-02-26 14:03:02 字數 3304 閱讀 6579

/// /// 在圖層裡面增加feature

///

/// 新增到的圖層的名稱

/// 當前axmapcontrol.map

/// 要新增的資料 datatable格式

public static void addfeature(string layer,imap pmap,datatable dt)

圖層失敗,請檢查空間資料庫是否有該圖層", layer));

}idataset ds = featurecls as idataset;

iworkspace workspace = ds.workspace;

iworkspaceedit edit = workspace as iworkspaceedit;

edit.startediting(false);

edit.disableundoredo();

edit.starteditoperation();

int num = -1;

for (int i = 0; i < pmap.layercount; i++)

}ifeaturecursor insercursor = featurecls.insert(true);

ifeaturebuffer buffer;

ifeaturelayer pfeaturelayer=pmap.get_layer(num) as ifeaturelayer;

ifeatureclass pfeatureclass = pfeaturelayer.featureclass;

ifeaturecursor cursor = pfeatureclass.search(null, false);

ifeature pfeature = cursor.nextfeature();

int count = 0;

while (pfeature != null)

m++;

}//ifeature newfeature = featurecls.createfeature();

buffer = featurecls.createfeaturebuffer();

= pfeature.shape;

buffer.shape = pfeature.shape;

for (int i = 0; i < dt.columns.count; i++)}}

insercursor.insertfeature(buffer);

if (count >= 100)

pfeature = cursor.nextfeature();

}insercursor.flush();

edit.stopediting(true);

edit.stopeditoperation();

}/// /// 刪除圖層指定feature

///

/// 要刪除的目標圖層名

/// 帶有要刪除feature的mapdocid值的list

public static void deletefeature(string layer,listmapdocid)

iqueryfilter pqueryfilter = new queryfilterclass();

pqueryfilter.whereclause = whereclause;

ifeaturecursor pfeaturecursor = pfeatureclass.update(pqueryfilter,false);

ifeature pfeature = pfeaturecursor.nextfeature();

while (pfeature != null)

system.runtime.interopservices.marshal.releasecomobject(pfeaturecursor);

}/// /// 刪除圖層指定feature

///

/// 要刪除的目標圖層名

/// 帶有要刪除feature的mapdocid值的list

public static void deletefeature(string layer, string mapdocid)

system.runtime.interopservices.marshal.releasecomobject(pfeaturecursor);

}/// /// 修改指定圖層的字段

///

/// 要修改欄位和值

/// 要修改的條件

/// 圖層名

///

public static bool editfield(dictionarydicvalue, dictionarydiccondition,string layer)

圖層失敗,請檢查空間資料庫是否有該圖層",layer));

}//得到該圖層下有多少資料

int featurecount = featurecls.featurecount(null);

int fieldindex = -1;

idataset ds = featurecls as idataset;

iworkspace workspace = ds.workspace;

iworkspaceedit edit = workspace as iworkspaceedit;

edit.startediting(false);

edit.disableundoredo();

ifeaturecursor updatecursor = featurecls.update(null, false);

edit.starteditoperation();

ifeature feature = updatecursor.nextfeature();

while (feature != null)

else

if (myindex == -1)

feature.set_value(myindex, myvalue.value);

updatecursor.updatefeature(feature);}}

}feature = updatecursor.nextfeature();

}edit.stopeditoperation();

edit.stopediting(true);

return true;

}catch(exception ex)

}public static ifeatureclass openlayer(string layername)

catch (exception)

}

arcgis engine中對要素類進行空間查詢

假設有個要素類是所有的面,現在想查詢哪個面包含了特定的座標點.這樣可以用空間過濾器,進行空間查詢來做.根據要查詢的座標構造乙個點 ipoint targetpoint new pointclass targetpoint.putcoords x,y 構造空間過濾器 ispatialfilter sp...

使用axios對json server的增刪改查

使用axios對json server的增刪改查 1 獲取資訊 get命令 2 增加資料 post命令 post命令一直報錯500錯誤,有id值才行 在這裡插入描述 3 刪除命令 delete delete也報了錯誤 一直404 問題是雖然一直報404 但我點開 是能找到資料的 解決方法 上面加id...

iOS 對plist增改操作

這篇文章是自己通過實踐獲取,在網上查過很多資料,也走了不上的彎路,由於剛開始學子不久,只是把自己遇到的問題貢獻給大家 一,建立檔案 獲取路徑物件 nsarray paths nssearchpathfordirectoriesindomains nsdocumentdirectory,nsuserd...