



全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
using System;using System.Collections.Generic;using System.Linq;using System.Text;using ESRI.ArcGIS.esriSystem;using ESRI.ArcGIS.Carto;using ESRI.ArcGIS.Controls;using ESRI.ArcGIS.SystemUI;using ESRI.ArcGIS.Geometry;using ESRI.ArcGIS.Geodatabase;using ESRI.ArcGIS.DataSourcesFile;using ESRI.ArcGIS.DataSourcesOleDB;namespace Moso_Bamboo_Forest_Visualization class LoadExcel private IFeatureClass createfeatureclass() string tempStorePath = System.Environment.CurrentDirectory; IWorkspaceFactory workspacefactory = new ShapefileWorkspaceFactoryClass(); IFeatureWorkspace featureworkspace = (IFeatureWorkspace)workspacefactory.OpenFromFile(tempStorePath, 0); string layerName = points; IFields pFields = new FieldsClass(); IFieldsEdit pFieldsEdit = pFields as IFieldsEdit; / IField shapeField = new FieldClass(); IFieldEdit shapeEdit = shapeField as IFieldEdit; shapeEdit.Name_2 = Shape; shapeEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; IGeometryDef pGeometryDef = new GeometryDefClass(); IGeometryDefEdit pGeometryDefEdit = pGeometryDef as IGeometryDefEdit; pGeometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint; ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference sr1; IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem(102100); sr1 = pcs; pGeometryDefEdit.SpatialReference_2 = sr1; shapeEdit.GeometryDef_2 = pGeometryDefEdit; pFieldsEdit.AddField(shapeField); IField x = new FieldClass(); IFieldEdit xx = x as IFieldEdit; xx.Name_2 = X; xx.Type_2 = esriFieldType.esriFieldTypeDouble; pFieldsEdit.AddField(x); IField y = new FieldClass(); IFieldEdit yy = y as IFieldEdit; yy.Name_2 = Y; yy.Type_2 = esriFieldType.esriFieldTypeDouble; pFieldsEdit.AddField(y); esriFeatureType pfeaturetype = esriFeatureType.esriFTSimple; IFeatureClass tempFeatureClass; tempFeatureClass = featureworkspace.CreateFeatureClass(layerName, pFields, null, null, pfeaturetype, Shape, text); return tempFeatureClass; public ILayer myGetExcelTable(string path) ESRI.ArcGIS.esriSystem.IPropertySet proset = new ESRI.ArcGIS.esriSystem.PropertySetClass(); string strcon = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= + path + ;Extended Properties=Excel 8.0; proset.SetProperty(CONNECTSTRING, strcon); IWorkspaceFactory workspf = new ESRI.ArcGIS.DataSourcesOleDB.OLEDBWorkspaceFactoryClass(); IFeatureWorkspace fworkfac = workspf.Open(proset, 0) as IFeatureWorkspace; IQueryDef myQueryDef = fworkfac.CreateQueryDef(); myQueryDef.Tables = Sheet1$; myQueryDef.SubFields = *; myQueryDef.WhereClause = ; ICursor myCursor = myQueryDef.Evaluate(); IRow myRow; IPoint point = new PointClass(); ILayer newlayer; IFeatureClass newfeatureclass = createfeatureclass(); ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference sr1; IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem(102100); sr1 = pcs; while (myRow = myCursor.NextRow() != null) point.PutCoords(double.Parse(myRow.get_Value(0).ToString(), double.Parse(myRow.get_Value(1).ToString(); point.SpatialReference = sr1; IFeatureCursor m_cursor = newfeatureclass.Insert(true); IFeatureBuffer m_buffer = newfeatureclass.CreateFeatureBuffer(); m_buffer.Shape = point; m_buffer.set_Value(newfeatureclass.FindField(X), double.Parse(myRow.get_Value(0).ToString(); m_buffer.set_Value(newfeatureclass.FindField(Y), double.Parse(myRow.get_Value(1).ToString(); m_cursor.InsertFeature(m_buffer
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 忻州市人民医院学科设备更新管理考核
- 家具生产实习报告(共20)
- 2025年中国神经酸项目创业计划书
- 中国高硼硅玻璃项目商业计划书
- 石家庄市人民医院呼吸科肺癌诊疗中心主任竞聘多学科协作考核
- 秦皇岛市人民医院纵隔肿瘤切除术技术考核
- 大同市人民医院碘-131治疗适应证把握与随访考核
- 中国对羟基苯乙醇项目创业计划书
- 赤峰市人民医院病历书写规范化操作考核
- 长治市人民医院冠心病介入诊疗独立术者资质认证综合评估试题
- SKF递进润滑系统-课件
- DB32/T 4401-2022《综合医院建筑设计标准》-(高清正版)
- 造口周围皮肤并发症 (伤口造口专科护理课件)
- 重症医学科优质护理服务工作计划
- 典范英语7-4中英文对照翻译Oh,otto!Oh,otto
- 危大工程动态管控表
- 检体诊断学循环系统查体教学课件
- 小学生文明就餐主题班会课件
- 工作分析(第二版)付亚和
- 地基验槽记录表.(范文)
- 浅析拉维莱特公园
评论
0/150
提交评论