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)的域范围(Domain)。
解决方法:通过以下代码进行设置Domain即可:pSpatialReference.SetDomain(xmin, xmax, ymin, ymax);
代码示例:
ISpatialReferenceFactory pSpatialReferenceEnvironment = new SpatialReferenceEnvironment();
pComReleaser.ManageLifetime(pSpatialReferenceEnvironment);
ISpatialReference pSpatialReference = pSpatialReferenceEnvironment.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_World_Mercator);
pComReleaser.ManageLifetime(pSpatialReference);
pSpatialReferenceEnvironment.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
pSpatialReference.SetDomain(-60000000, 60000000, -60000000, 60000000);
//创建要素数据集
IFeatureDataset pFeatureDataset = PGeoDbGeneral.CreateFeatureDataset(pWorkspace, txtFtDataset.Text, pSpatialReference);
pComReleaser.ManageLifetime(pFeatureDataset);
posted on 2015-05-12 16:07 jingkunliu 阅读(1357) 评论(0) 编辑 收藏 举报