public void CanGetExistingRowsFastEnough() { IFeatureWorkspace ws = OpenTestWorkspace(); ITable fc = ws.OpenTable("TOPGIS_TLM.TLM_WANDERWEG"); const int max = 100; IDictionary <int, IRow> rows = GetFirstNRows(fc, max); var watch = new Stopwatch(); watch.Start(); foreach (int oid in rows.Keys) { Assert.NotNull(GdbQueryUtils.GetRow(fc, oid)); _msg.Info($"Oid {oid} time: {watch.ElapsedMilliseconds}"); } watch.Stop(); double msPerIteration = watch.ElapsedMilliseconds / (double)rows.Count; _msg.InfoFormat(@"GetRow() per iteration: {0} ms", msPerIteration); Assert.True(msPerIteration < 50, "GetFeature with existing feature takes too long ({0} ms, {1} rows)", msPerIteration, rows.Count); }
public void CanGetNullForNonExistingRow() { IFeatureWorkspace ws = OpenTestWorkspace(); ITable table = ws.OpenTable("TOPGIS_TLM.TLM_WANDERWEG"); Assert.Null(GdbQueryUtils.GetRow(table, 999999999)); }
public void CanGetNullForNonExistingFeatureByGetRow() { IFeatureWorkspace ws = OpenTestWorkspace(); IFeatureClass fc = ws.OpenFeatureClass("TOPGIS_TLM.TLM_STRASSE"); Assert.Null(GdbQueryUtils.GetRow((ITable)fc, 999999999)); }
public static void UpdateDescription(string path, string featureClassName, int oid) { using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(path, UriKind.Absolute)))) { using (var table = geodatabase.OpenDataset <Table>(featureClassName)) { var row = GdbQueryUtils.GetRow(table, oid); row["Description"] = "Moe"; row.Store(); } } }
public static Row GetRow(string path, string tableName, long oid) { var uri = new Uri(path, UriKind.Absolute); using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(uri))) { using (var table = geodatabase.OpenDataset <Table>(tableName)) { return(GdbQueryUtils.GetRow(table, oid)); } } }
public static void UpdateFeatureGeometry(string path, string featureClassName, Geometry newGeometry, int oid) { using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(path, UriKind.Absolute)))) { using (var featureClass = geodatabase.OpenDataset <FeatureClass>(featureClassName)) { var feature = (Feature)GdbQueryUtils.GetRow(featureClass, oid); feature.SetShape(newGeometry); feature.Store(); } } }
private object GetStatusFromDatabase(string featureClass, string statusField) { object status; var uri = new Uri(_emptyIssuesGdb, UriKind.Absolute); using (var geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(uri))) { using (var fc = geodatabase.OpenDataset <FeatureClass>(featureClass)) { Row row = GdbQueryUtils.GetRow(fc, 1); status = row[statusField]; } } return(status); }