ArcEngine :The XY domain on the spatial reference is not set or invalid错误

在创建数据集的时候,提示The XY domain on the spatial reference is not set or invalid错误。

原因:未设置空间参考(ISpatialReference:pSpatialReference)的域范围(Domain)。

解决办法:

(1) 通过以下代码进行设置Domain即可:

  pSpatialReference.SetDomain(xmin, xmax, ymin, ymax);

或者

            ESRI.ArcGIS.Geometry.ISpatialReferenceResolution spatialReferenceResolution = pSpatialReference as ESRI.ArcGIS.Geometry.ISpatialReferenceResolution;
            spatialReferenceResolution.ConstructFromHorizon();
            ESRI.ArcGIS.Geometry.ISpatialReferenceTolerance spatialReferenceTolerance = spatialReferenceResolution as ESRI.ArcGIS.Geometry.ISpatialReferenceTolerance;
            spatialReferenceTolerance.SetDefaultXYTolerance();

设置完毕后,可以通过:

  pSpatialReference.GetDomain(out XMin,out XMax,out YMin,out YMax) 查看Domain

原文地址:https://www.cnblogs.com/cglNet/p/4635732.html