ArcGIS 10.0 ArcGIS 9.3.1数据生成实验--个人地理数据库
?
? ? ? 前段時間有個同事需要用到arcgis 工具將生成的分析數(shù)據(jù)轉(zhuǎn)出為arcgis的格式存儲到個人地理數(shù)據(jù)庫中。但是在數(shù)據(jù)生成過程中,發(fā)現(xiàn)數(shù)據(jù)加載到arcmap放大到一定比例尺后數(shù)據(jù)就消失了,給我的第一個感覺,問題應(yīng)該出現(xiàn)在坐標系統(tǒng)、容差設(shè)置等出了問題。于是我在自己的電腦上也實驗了一下,發(fā)現(xiàn)無論怎么設(shè)置,都會有這個問題,即數(shù)據(jù)放大后就消失不顯示。
? ? ? 但是如果新建一個個人地理數(shù)據(jù)庫,再把生成的數(shù)據(jù)導(dǎo)入到新建的數(shù)據(jù)庫中再放大顯示就沒有問題。所以很奇怪,直到今天的測試,才發(fā)現(xiàn)這有可能是10.0的一個bug,或者哪里沒有設(shè)置好,看到的朋友如果直到的話,希望聯(lián)系本人或者下面直接留言,望不吝賜教。
簡單起見,數(shù)據(jù)都不設(shè)置坐標系統(tǒng),僅設(shè)置地圖數(shù)據(jù)框的顯示單位
導(dǎo)出的要素數(shù)據(jù)
?
再放大也是毫無壓力的
?下面是測試代碼
1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using ESRI.ArcGIS.esriSystem; 5 using ESRI.ArcGIS.Geodatabase; 6 using ESRI.ArcGIS.Geometry; 7 using ESRI.ArcGIS.DataSourcesGDB; 8 9 namespace createmdbandinsertfc 10 { 11 class Program 12 { 13 private static LicenseInitializer m_AOLicenseInitializer = new createmdbandinsertfc.LicenseInitializer(); 14 15 [STAThread()] 16 static void Main(string[] args) 17 { 18 //ESRI License Initializer generated code. 19 m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeArcInfo }, 20 new esriLicenseExtensionCode[] { }); 21 CretePGDB(); 22 //ESRI License Initializer generated code. 23 //Do not make any call to ArcObjects after ShutDownApplication() 24 m_AOLicenseInitializer.ShutdownApplication(); 25 } 26 27 private static void CretePGDB() 28 { 29 Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory"); 30 IWorkspaceFactory2 workspaceFactory = (IWorkspaceFactory2)Activator.CreateInstance(factoryType); 31 IWorkspaceName workspaceName = workspaceFactory.Create(@"c:\", "Sample.mdb", null, 0); 32 33 //// Cast the workspace name object to the IName interface and open the workspace. 34 IName name = (IName)workspaceName; 35 IWorkspace workspace = (IWorkspace)name.Open(); 36 37 //直接打開 38 //IWorkspaceFactory pwf = new AccessWorkspaceFactory(); 39 //IWorkspace workspace = pwf.OpenFromFile(@"c:\Sample.mdb", 0); 40 //IFeatureWorkspace pFW = workspace as IFeatureWorkspace; 41 //IFeatureDataset pFD = pFW.OpenFeatureDataset("DXT"); 42 43 ISpatialReferenceFactory3 spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); 44 ISpatialReference pSRF = new UnknownCoordinateSystemClass(); 45 ISpatialReferenceResolution pSRFResolu = (ISpatialReferenceResolution)pSRF; 46 pSRFResolu.ConstructFromHorizon(); 47 pSRF.SetZDomain(0, 1); 48 pSRF.SetMDomain(0, 1); 49 ISpatialReferenceTolerance pSRFtolerance = (ISpatialReferenceTolerance)pSRF; 50 pSRFtolerance.SetDefaultXYTolerance(); 51 pSRFtolerance.SetDefaultMTolerance(); 52 pSRFtolerance.SetDefaultZTolerance(); 53 IControlPrecision2 controlPrecision = pSRF as IControlPrecision2; 54 controlPrecision.IsHighPrecision = true; 55 56 //創(chuàng)建FeatureDataSet 57 IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace; 58 IFeatureDataset pDC = featureWorkspace.CreateFeatureDataset("DXT", pSRF); 59 //IFeatureClass pFC = CreateFeatureClass(pSRF, featureWorkspace); 60 IFeatureClass pFC = CreateFeatureClass(pSRF, pDC); 61 IGeodatabaseRelease pGDBR = workspace as IGeodatabaseRelease; 62 Console.WriteLine(pGDBR.MajorVersion + "." + pGDBR.MinorVersion + "-" + pGDBR.BugfixVersion); 63 pGDBR.Upgrade(); 64 Console.WriteLine(pGDBR.MajorVersion + "." + pGDBR.MinorVersion + "-" + pGDBR.BugfixVersion); 65 //IGeoDatasetSchemaEdit2 pGDSE = pDC as IGeoDatasetSchemaEdit2; 66 //pGDSE.AlterSpatialReference(pSRF); 67 //pGDSE.AlterResolution(1000,1, 1); 68 //根據(jù)創(chuàng)建的featuredataset創(chuàng)建featureclasss 69 //IFeatureClass pFC = CreateFeatureClass((pFD as IGeoDataset).SpatialReference, (pFD as IFeatureDataset)); 70 71 //直接打開已有的FC 72 //IFeatureClass pFC = pFW.OpenFeatureClass("節(jié)點"); 73 74 //IFeatureBuffer fb; 75 //IFeatureCursor insertCursor = pFC.Insert(true); 76 //IPoint point; 77 //for (int i = 0; i < 100; i++) 78 //{ 79 // fb = pFC.CreateFeatureBuffer(); 80 // point = new PointClass(); 81 // point.PutCoords(40000.0+i*1000, 4000.0-i*200); 82 // fb.Shape = point; 83 // insertCursor.InsertFeature(fb); 84 //} 85 IWorkspace pws = ((IDataset)pFC).Workspace; 86 IWorkspaceEdit pwe = pws as IWorkspaceEdit; 87 bool startEdit = pwe.IsBeingEdited(); 88 if (!startEdit) 89 { 90 pwe.StartEditing(false); 91 } 92 pwe.StartEditOperation(); 93 94 //是否需要清除原來數(shù)據(jù) 95 96 97 IFeature pFeature; 98 for (double i = 0; i < 180; i+=0.5) 99 { 100 pFeature = pFC.CreateFeature(); 101 IPoint point = new PointClass(); 102 point.PutCoords(i ,Math.Sin(90*i*Math.PI/180.0)); 103 pFeature.Shape = point; 104 pFeature.Store(); 105 pFeature = null; 106 } 107 108 pwe.StopEditOperation(); 109 startEdit = pwe.IsBeingEdited(); 110 if (startEdit) 111 { 112 pwe.StopEditing(true); 113 } 114 115 } 116 117 //private static IFeatureClass CreateFeatureClass(ISpatialReference pSRF, IFeatureWorkspace pDC) 118 private static IFeatureClass CreateFeatureClass(ISpatialReference pSRF, IFeatureDataset pDC) 119 { 120 // Locations are all relative to the location of the reference lines. 121 // For geodatabase, signs feature class is at the same location and the streets table 122 // is at the level of the containing feature dataset. 123 // For shapefile, both are at the same location as the reference lines. 124 // start with the initial set of required fields for a feature class 125 126 IFeatureClassDescription fcDescription = new FeatureClassDescriptionClass(); 127 IObjectClassDescription ocDescription = fcDescription as IObjectClassDescription; 128 IFieldsEdit outFields = ocDescription.RequiredFields as IFieldsEdit; 129 130 // make the shape field to be of type polyline with the same spatial reference as the reference lines 131 132 IField shapeField = outFields.get_Field(outFields.FindField(fcDescription.ShapeFieldName)); 133 IGeometryDefEdit geomDefEdit = shapeField.GeometryDef as IGeometryDefEdit; 134 geomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint; 135 // Set the grid count to 1 and the grid size to 0 to allow ArcGIS to 136 // determine a valid grid size. 137 geomDefEdit.GridCount_2 = 1; 138 geomDefEdit.set_GridSize(0, 0); 139 geomDefEdit.SpatialReference_2 = pSRF; 140 141 // add the other fields to the feature class 142 143 IFieldEdit field = new FieldClass(); 144 field.Name_2 = "ExitName"; 145 field.Type_2 = esriFieldType.esriFieldTypeString; 146 field.Length_2 = 10; 147 outFields.AddField(field); 148 149 field = new FieldClass(); 150 field.Name_2 = "X"; 151 field.Type_2 = esriFieldType.esriFieldTypeString; 152 field.Length_2 = 75; 153 outFields.AddField(field); 154 155 field = new FieldClass(); 156 field.Name_2 = "Y"; 157 field.Type_2 = esriFieldType.esriFieldTypeString; 158 field.Length_2 = 75; 159 outFields.AddField(field); 160 161 field = new FieldClass(); 162 field.Name_2 = "Branch" + "Lng"; 163 field.Type_2 = esriFieldType.esriFieldTypeString; 164 field.Length_2 = 2; 165 outFields.AddField(field); 166 167 field = new FieldClass(); 168 field.Name_2 = "Toward"; 169 field.Type_2 = esriFieldType.esriFieldTypeString; 170 field.Length_2 = 75; 171 outFields.AddField(field); 172 173 field = new FieldClass(); 174 field.Name_2 = "Toward" + "Lng"; 175 field.Type_2 = esriFieldType.esriFieldTypeString; 176 field.Length_2 = 2; 177 outFields.AddField(field); 178 return pDC.CreateFeatureClass( 179 "節(jié)點", 180 outFields, 181 ocDescription.InstanceCLSID, 182 ocDescription.ClassExtensionCLSID, 183 esriFeatureType.esriFTSimple, 184 fcDescription.ShapeFieldName, 185 "" 186 ); 187 } 188 189 190 } 191 } View Code本機環(huán)境
Windows server 2008 r2
ArcGIS 10.0 sp5
代碼分別又在下面兩個環(huán)境進行了測試,僅修改授權(quán)過程部分代碼。
測試環(huán)境【一】
Windows server 2003
ArcGIS 9.3.1
生成的數(shù)據(jù)可以正常放大顯示,不會出現(xiàn)消失的現(xiàn)象
??
?測試環(huán)境【二】
Windows 10
ArcGIS10.2
?
?效果同10.0
?
沒辦法,直接打開MDB
比較也未有什么重要發(fā)現(xiàn)。
arcgis 931平臺的PGDB版本2.3.0
arcgis 10.0和arcgis10.2的PGDB 3.0.0
難道真的是軟件自身的bug嗎?
轉(zhuǎn)載于:https://www.cnblogs.com/5igis/p/5igis_11793.html
總結(jié)
以上是生活随笔為你收集整理的ArcGIS 10.0 ArcGIS 9.3.1数据生成实验--个人地理数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于box-shadow、border-
- 下一篇: 开发第五天