如题,创建矢量数据集并填充属性成功,数据估计是存储在数据集内存中(矢量符号化成功),但是调用query接口时,则查询为空。是否有什么接口未调用?
是有重新获取datasetvector,重新获取datasource及对应的datasetvector后,能获取到对应的数据集,但是其recordset recordcount 仍然为0(此数据集为三维数据集,是否有关)
您好,我在本地测试了您说的情况,不会是因为三维数据集造成的影响,建议您可以参考以下测试代码对比您写的逻辑有区别的地方。
static void Main(string[] args) { DatasourceConnectionInfo datasourceConnectionInfo = new DatasourceConnectionInfo(); datasourceConnectionInfo.EngineType = EngineType.Memory; Workspace workspace = new Workspace(); Datasource datasource = workspace.Datasources.Create(datasourceConnectionInfo); DatasetVectorInfo datasetVectorInfo = new DatasetVectorInfo(); datasetVectorInfo.Type = DatasetType.Point3D; datasetVectorInfo.Name = "testModel"; DatasetVector datasetVector = datasource.Datasets.Create(datasetVectorInfo); Recordset recordset = datasetVector.GetRecordset(false, CursorType.Dynamic); Console.WriteLine("datasetVector: " + datasetVector.RecordCount + " RecordsetCount: " + recordset.RecordCount); GeoPoint3D geoPoint3D = new GeoPoint3D(0, 0, 0); recordset.Batch.Begin(); if (recordset.AddNew(geoPoint3D)) { Console.WriteLine("添加数据成功"); } recordset.Batch.Update(); recordset.Close(); recordset.Dispose(); Recordset recordset1 = datasetVector.GetRecordset(false, CursorType.Static); Console.WriteLine("datasetVector: " + datasetVector.RecordCount + " RecordsetCount: " + recordset1.RecordCount); Console.ReadKey(); }
更换了 Recordset.BatchEditor接口,记录集则正常了!