嗨@mody_buchbinder你能给我们发一个导致这个问题的代码片段吗?我们无法重现不尊重DDL提供的规模和精度的场景。
Pro和SQL Server的版本信息也有助于进一步诊断。
下面的字段描述在我们的测试中成功地创建了一个具有比例和精度的双重字段。
FieldDescription doubleFieldDescription = new FieldDescription("TestDoubleField", FieldType.Double) {Scale = 3, Precision = 9};
我接受纠正。Geodatabase团队指出了我在测试加载项中选择的刻度大于精度的错误。一旦我修复了这个错误,我得到了正确的结果:
我使用下面的代码片段创建特性类。“selectedFeatureLayer”是我从TOC获得的一个功能层,以便获得我的数据库连接。
var selectedLayerTable = selectedfeaturellayer . getttable ();var testName = $@"点{日期时间。现在:HHmmss}";var hasZ = false;var hasM = false;//创建一个ShapeDescription对象var ShapeDescription = new ShapeDescription(几何类型。点,SpatialReferences.WebMercator) {HasM = HasM, HasZ = HasZ};var objectIDFieldDescription = new ArcGIS.Core.Data.DDL. varFieldDescription(“ObjectID”,FieldType.OID);var stringFieldDescription = new ArcGIS.Core.Data.DDL. varFieldDescription(“TheString”,FieldType.String);var intFieldDescription = new ArcGIS.Core.Data.DDL. varFieldDescription(“TheInteger”,FieldType.Integer);var dblFieldDescription = new ArcGIS.Core.Data.DDL. varFieldDescription("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() { 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}"); } }
你好@Wolf
下面是代码,注意数据库是内存数据库。
然而结果是:
private async Task CreateParcelTempLayers(Polygon parcelGeometry, bool shouldGeneralize) {var memoryConnectionProperties = new memoryConnectionProperties ();var map = MapView.Active.Map;使用var geodatabase = SchemaBuilder.CreateGeodatabase(内存连接属性);BuildEdgesLayer(地图,geodatabase);} //和下面的私有void BuildEdgesLayer(Map Map, Geodatabase Geodatabase) {var shapeDescription = new shapeDescription(几何类型。多段线,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。reportsmanagerproxy_builddgeslayer_distancesalias},};var featureClassDescription = new featureClassDescription (m_ParcelEdgesLayerName, fielddescription, shapeDescription);var schemaBuilder = new schemaBuilder (geodatabase);schemaBuilder.Create (featureClassDescription);var success = schemaBuilder.Build(); }
想听听你的反馈吗