欢迎来到天天文库
浏览记录
ID:55642013
大小:34.50 KB
页数:9页
时间:2020-05-22
《经纬度生成图层.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、经纬度生成点图层privateIFeatureClassCreateShapefile(stringfolderPath,DatabaseRecordsetmodel,stringstrFeatureClassName,intGeometryType) { IWorkspaceFactorypFeatWorkspaceFac=newShapefileWorkspaceFactory(); IFeatureWorkspace
2、pFeatWorkspace=pFeatWorkspaceFac.OpenFromFile(folderPath,0)asIFeatureWorkspace; if(pFeatWorkspace==null)returnnull; ESRI.ArcGIS.Geodatabase.IFieldoField=newESRI.ArcGIS.Geodatabase.FieldClass(); ESRI.ArcGIS.Geodatabase.IF
3、ieldsoFields=newESRI.ArcGIS.Geodatabase.FieldsClass(); IFieldsEditoFieldsEdit=null; IFieldEditoFieldEdit=null; IFeatureClassoFeatureClass=null; longFCount=model.GetFieldCount(); try {
4、 oFieldsEdit=oFieldsasESRI.ArcGIS.Geodatabase.IFieldsEdit; oFieldEdit=oFieldasESRI.ArcGIS.Geodatabase.IFieldEdit; oFieldEdit.Name_2="Shape"; oFieldEdit.Type_2=esriFieldType.esriFieldTypeGeometry;
5、 IGeometryDefpGeo=newGeometryDefClass(); IGeometryDefEditpGeoEdit=(IGeometryDefEdit)pGeo; if(GeometryType==0) { pGeoEdit.GeometryType_2=esriGeometryType.esriGeometryPoint;
6、 } elseif(GeometryType==1) { pGeoEdit.GeometryType_2=esriGeometryType.esriGeometryPolyline; } else { pGeoEdit.GeometryType_2=esriGeometryType
7、.esriGeometryPolygon; } //依据GeometryType创建相应几何类型的要素类 stringProjPath=Application.StartupPath+"\xian1980gkzone18.prj"; ISpatialReferenceFactory2spatialReferenceFactory=newSpatialReferenceEnvironm
8、entClass(); ISpatialReference2spatialReference=spatialReferenceFactory.CreateESRISpatialReferenceFromPRJFile(ProjPath)asISpatialReference2; pGeoEdit.SpatialReference_2=spatialReference; //新要素类的空间参考依据投影文件xian1
此文档下载收益归作者所有