arcengine创建dataset COMException

.Net技术 码拜 10年前 (2015-04-01) 1093次浏览 0个评论
 

 打开数据库
IFeatureWorkspace pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(@”D:\qqq.mdb”, 0) as IFeatureWorkspace;
设置投影
ISpatialReferenceFactory pSpatialReferenceFac = new SpatialReferenceEnvironmentClass();
            ISpatialReference pSpatialReference = pSpatialReferenceFac.CreateProjectedCoordinateSystem((int)esriSRProjCS4Type.esriSRProjCS_Xian1980_3_Degree_GK_Zone_37);
创建dataset
pFeatureWorkspace.CreateFeatureDataset(“abc”,pSpatialReference);
报错
The XY domain on the spatial reference is not set or invalid.
截图如下
arcengine创建dataset COMException

arcengine创建dataset COMException
40分
 pSpatialReference 需要设置domian

pSpatialReference.SetDomain(-60000000, 60000000, -60000000, 60000000);

你看看ISpatialReference的SetDomain方法的说明.

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);

arcengine创建dataset COMException
也可以通过ISpatialReferenceTolerance与ISpatialReferenceResolution默认值达到效果

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明arcengine创建dataset COMException
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!