主题Re:在ArcGIS Pro SDK问题中使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072260#M6800 谢谢你的报道。    我将向Geodatabase团队报告这个问题。

2021年6月24日星期四22:01:48 GMT 2021 - 06 - 24 t22:01:48z 使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1071947#M6793

Hello all

我们正在尝试使用新的DDL

字段in 层在SQL server。

看起来代码忽略了比例和精度。 

试图用GP工具(添加字段)做同样的工作。

这是一个bug,功能还是下一个版本会出现的东西?< / P > < P > < / P >感谢 2021年6月24日星期四12:32:39 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1071947#M6793 mody_buchbinder 2021 - 06 - 24 t12:32:39z Re:使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072194#M6797

@mody_buchbinder ,你能给我们一个导致这个问题的代码片段吗?我们无法重现不尊重通过DDL提供的规模和精度的场景。

Pro和SQL Server的版本信息也有助于进一步诊断。 

下面的字段描述在我们的测试中成功创建了一个具有规模和精度的双字段

 

FieldDescription doubleFieldDescription = new FieldDescription("TestDoubleField", FieldType.Double) {scale = 3,AashisLamsal1_0-1624558060157.jpeg

 

2021年6月24日星期四19:28:37 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072194#M6797 Aashis 2021 - 06 - 24 t19:28:37z
Re:使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072260#M6800 谢谢你的报道。    我将向Geodatabase团队报告这个问题。

2021年6月24日星期四22:01:48 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072260#M6800 2021 - 06 - 24 t22:01:48z
Re:使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072351#M6802

我更正。 Geodatabase团队指出了我的测试插件中的一个错误,我选择了一个比精度更大的刻度。一旦我修复了这个错误,我就得到了正确的结果:

Wolf_0-1624571868016.png

 

我使用下面的代码片段来创建功能类。 'selectedFeatureLayer'是我从TOC获得的功能层,以便获得我的数据库连接。

var selectedLayerTable = selectedFeatureLayer.GetTable();var testName = $@"Point{DateTime.Now:HHmmss}";var hasZ = false;var hasM = false;//创建ShapeDescription对象var ShapeDescription = new ShapeDescription(点,SpatialReferences.WebMercator) {HasM = HasM, HasZ = HasZ};var objecdfielddescription = new ArcGIS.Core.Data.DDL. varFieldDescription(“ObjectID”,FieldType.OID); var stringFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheString", FieldType.String); var intFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheInteger", FieldType.Integer); var dblFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheDouble", FieldType.Double) { Precision = 9, Scale = 5 }; var dateFieldDescription = new ArcGIS.Core.Data.DDL.FieldDescription("TheDate", FieldType.Date); using (var geoDb = selectedLayerTable.GetDatastore() as Geodatabase) { var fcName = $@"{testName}"; try { // Assemble a list of all of our field descriptions var fieldDescriptions = new List<ArcGIS.Core.Data.DDL.FieldDescription>() { objectIDFieldDescription, stringFieldDescription, intFieldDescription, dblFieldDescription, dateFieldDescription }; // Create a FeatureClassDescription object to describe the feature class to create var fcDescription = new FeatureClassDescription(fcName, fieldDescriptions, shapeDescription); // Create a SchemaBuilder object SchemaBuilder schemaBuilder = new SchemaBuilder(geoDb); // Add the creation of the Cities feature class to our list of DDL tasks schemaBuilder.Create(fcDescription); // Execute the DDL bool success = schemaBuilder.Build(); } catch (Exception ex) { MessageBox.Show($@"Exception: {ex}"); } }

 

2021年6月24日星期四22:01:06 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1072351#M6802 2021 - 06 - 24 t22:01:06z
Re:使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073112#M6808

Hello @Wolf 

 

下面是代码,注意数据库是内存数据库。

然而结果是: 

 

private async Task CreateParcelTempLayers(Polygon parcelGeometry, bool shouldGeneralize) {var memoryConnectionProperties = new memoryConnectionProperties ();var map = MapView.Active.Map;使用var geodatabase = schemabubuilder . creategeodatabase (memoryConnectionProperties);BuildEdgesLayer(地图,geodatabase);} //和bellow私有void BuildEdgesLayer(Map Map, Geodatabase Geodatabase) {var shapeDescription = new shapeDescription (GeometryType。多段线,map.SpatialReference);var FieldDescription = new[] {new FieldDescription(m_FromVertexToVertex, FieldType.String){Length = 50}, new FieldDescription(m_EdgeLength, FieldType.Double) {Scale = 2, Precision = 9, AliasName = ReportsManagerResources. varReportsManagerProxy_BuildEdgesLayer_DistancesAlias},};var featureClassDescription = new featureClassDescription (m_ParcelEdgesLayerName, fielddescriptionshapedescription);var schemaBuilder = new schemaBuilder (geodatabase);schemaBuilder.Create (featureClassDescription); var success = schemaBuilder.Build(); }

 image.png

 

Would love to hear your feedback

2021年6月28日星期一08:41:18 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073112#M6808 dkuida 2021 - 06 - 28 - t08:41:18z
Re:使用DDL创建双字段 //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073236#M6810

感谢您的报告,一个ArcGIS Pro Geodatabase团队成员在使用内存Geodatabase时能够重复这个问题。这个问题将在即将发布的Pro版本中修复 2021年6月28日星期一15:51:55 GMT //www.gamepadva.com/t5/arcgis-pro-sdk-questions/create-a-double-field-using-the-ddl/m-p/1073236#M6810 2021 - 06 - 28 - t15:51:55z