/// <summary> /// 插入从MapServer获取到的JSON数据 /// </summary> /// <param name="features"></param> /// <returns></returns> public int InsertFeaturesByJson(JArray features) { int featureNum = 0; try { ZFeatureCursor cursor = Insert(true); foreach (JObject feature in features) { try { ZFeatureBuffer buffer = CreateFeatureBuffer(); buffer.SetShapeByJson(feature.Value <JObject>("geometry")); buffer.SetAttrsByJson(feature.Value <JObject>("attributes")); cursor.InsertFeature(buffer); } catch (Exception ex) { Logger.log("ZFeatureClass.InsertFeaturesByJson", ex); } featureNum++; } cursor.Flush(); } catch (Exception ex) { Logger.log("ZFeatureClass.InsertFeaturesByJson", ex); } return(featureNum); }
/// <summary> /// 插入一条记录 /// </summary> /// <param name="zbuffer"></param> public void InsertFeature(ZFeatureBuffer zbuffer) { cursor.InsertFeature(zbuffer.buffer); }