ArcGIS Engine——坐标系相关

Posted zwcoding

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcGIS Engine——坐标系相关相关的知识,希望对你有一定的参考价值。

    public class SpatialReferenceHelpers
    {
/// <summary> /// 创建地理坐标系 /// </summary> /// <param name="FactoryCode"></param> /// <returns></returns> public ISpatialReference CreateGeographicSpatialReference(ESRI.ArcGIS.Geometry.esriSRGeoCSType FactoryCode) { return CreateGeographicSpatialReference((int)FactoryCode); } public ISpatialReference CreateGeographicSpatialReference(int FactoryCode) { ISpatialReferenceFactory2 oSpatialReferenceFactory; ISpatialReference oCS; try { Type t = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); oSpatialReferenceFactory = (ISpatialReferenceFactory2)Activator.CreateInstance(t); oCS = oSpatialReferenceFactory.CreateSpatialReference(FactoryCode); return oCS; } catch { return null; } }


/// <summary> /// 创建投影坐标系 /// </summary> /// <param name="pcsType"></param> /// <returns></returns> public ISpatialReference CreateProjectSpatialReference(esriSRProjCS4Type pcsType) { return CreateProjectSpatialReference((int)pcsType); } public ISpatialReference CreateProjectSpatialReference(int FactoryCode) { ISpatialReferenceFactory2 oSpatialReferenceFactory; ISpatialReference oCS; try { Type t = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); oSpatialReferenceFactory = (ISpatialReferenceFactory2)Activator.CreateInstance(t); oCS = oSpatialReferenceFactory.CreateProjectedCoordinateSystem(FactoryCode); return oCS; } catch { return null; } }
/// <summary> /// 图形坐标系变换 /// </summary> /// <param name="pGeometry"></param> /// <param name="pInputSR"></param> /// <param name="pOutputSR"></param> /// <returns></returns> public IGeometry TransformShapeCS(IGeometry pGeometry, ISpatialReference pInputSR, ISpatialReference pOutputSR) { IGeometry oGeometry; try { oGeometry = pGeometry; oGeometry.SpatialReference = pInputSR; oGeometry.Project(pOutputSR); return oGeometry; } catch { return pGeometry; } } /// <summary> /// 修改要素集空间参考 /// </summary> /// <param name="pFeatureDataset">要素集</param> /// <param name="pSpatialReference">新空间参考</param> public static void AlterSpatialReference(IFeatureDataset pFeatureDataset, ISpatialReference pSpatialReference) { IGeoDataset pGeoDataset = pFeatureDataset as IGeoDataset; IGeoDatasetSchemaEdit pGeoDatasetSchemaEdit = pGeoDataset as IGeoDatasetSchemaEdit; if (pGeoDatasetSchemaEdit.CanAlterSpatialReference == true) pGeoDatasetSchemaEdit.AlterSpatialReference(pSpatialReference); }

/// <summary> /// 获取要素集空间参考 /// </summary> /// <param name="pGeoDataset">要素集</param> /// <returns></returns> public static ISpatialReference GetSpatialReference(IGeoDataset pGeoDataset) { return pGeoDataset.SpatialReference; } public static ISpatialReference GetSpatialReference(IFeatureDataset pFeatureDataset) { return GetSpatialReference(pFeatureDataset as IGeoDataset); } public static ISpatialReference GetSpatialReference(IFeatureLayer pFeatureLayer) { return GetSpatialReference(pFeatureLayer.FeatureClass); } public static ISpatialReference GetSpatialReference(IFeatureClass pFeatureClass) { return GetSpatialReference(pFeatureClass as IGeoDataset); } }

以上是关于ArcGIS Engine——坐标系相关的主要内容,如果未能解决你的问题,请参考以下文章

ArcGIS Engine中空间参照(地理坐标)相关方法总结转

arcgis engine 二次开发怎样获取某线要素的结点及各结点的坐标值?还要识别出端点。

arcgis engine的ilayer怎么创建

Arcgis Engine矢量裁剪栅格,调用Mask工具相关代码

ArcGIS Engine开发之地图浏览

请问你是如何具体实现的 arcgis engine 二次开发怎样获取某线要素的结点及各结点的坐标值?