在RGEOS项目中,投影变换是通过Proj.Net来实现的。

支持的投影主要包括AlbersProjection、TransverseMercator、Mercator、Krovak、Lambert Conformal Conic 2SP,自己扩展了一个GaussKruger投影。

以下实现了一个WGS84椭球的UTM投影(TransverseMercator)

 ICoordinateSystem utm = ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WGS84_UTM(zone, pGeo.Y > );

查看代码:

 public static ProjectedCoordinateSystem WGS84_UTM(int Zone, bool ZoneIsNorth)
{
List<ProjectionParameter> pInfo = new List<ProjectionParameter>();
pInfo.Add(new ProjectionParameter("latitude_of_origin", ));
pInfo.Add(new ProjectionParameter("central_meridian", Zone * - ));
pInfo.Add(new ProjectionParameter("scale_factor", 0.9996));
pInfo.Add(new ProjectionParameter("false_easting", ));
pInfo.Add(new ProjectionParameter("false_northing", ZoneIsNorth ? : ));
//IProjection projection = cFac.CreateProjection("UTM" + Zone.ToString() + (ZoneIsNorth ? "N" : "S"), "Transverse_Mercator", parameters);
Projection proj = new Projection("Transverse_Mercator", pInfo, "UTM" + Zone.ToString(System.Globalization.CultureInfo.InvariantCulture) + (ZoneIsNorth ? "N" : "S"),
"EPSG", + Zone + (ZoneIsNorth ? : ), String.Empty, String.Empty, String.Empty);
System.Collections.Generic.List<AxisInfo> axes = new List<AxisInfo>();
axes.Add(new AxisInfo("East", AxisOrientationEnum.East));
axes.Add(new AxisInfo("North", AxisOrientationEnum.North));
return new ProjectedCoordinateSystem(ProjNet.CoordinateSystems.HorizontalDatum.WGS84,
ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84, ProjNet.CoordinateSystems.LinearUnit.Metre, proj, axes,
"WGS 84 / UTM zone " + Zone.ToString(System.Globalization.CultureInfo.InvariantCulture) + (ZoneIsNorth ? "N" : "S"), "EPSG", + Zone + (ZoneIsNorth ? : ),
String.Empty, "Large and medium scale topographic mapping and engineering survey.", string.Empty);
}

WGS84_UTM

自己尝试写一个工厂没有写完全:

 using System;
using System.Collections.Generic;
using System.Text; namespace ProjNet.CoordinateSystems
{
public class SpatialReferenceEnvironmentClass : ISpatialReferenceFactory
{
public IEllipsoid CreateSpheroid(int spheroidType)
{
IEllipsoid ellipsoid = null;
switch (spheroidType)
{
case (int)RgSRSpheroidType.RgSRSpheroid_WGS1984:
ellipsoid = new Ellipsoid(, , 298.257223563, true, LinearUnit.Metre, "WGS 84", "EPSG", , "WGS 84", "", "Inverse flattening derived from four defining parameters (semi-major axis; C20 = -484.16685*10e-6; earth's angular velocity w = 7292115e11 rad/sec; gravitational constant GM = 3986005e8 m*m*m/s/s).");
break;
case (int)RgSRSpheroidType.RgSRSpheroid_Krasovsky1940:
ellipsoid = new Ellipsoid(, , 298.30000000000001, true, LinearUnit.Metre, "Krasovsky_1940", "EPSG", , "Krasovsky_1940", "", "");
break;
case (int)RgSRSpheroid2Type.RgSRSpheroid_Xian1980:
ellipsoid = new Ellipsoid(, , 298.25700000000001, true, LinearUnit.Metre, "Xian_1980", "EPSG", , "Xian_1980", "", "");
break;
}
return ellipsoid;
} public IHorizontalDatum CreateDatum(int datumType)
{
IHorizontalDatum datum = null;
switch (datumType)
{
case (int)RgSRDatumType.RgSRDatum_WGS1984:
IEllipsoid ellipsoid = this.CreateSpheroid((int)RgSRSpheroidType.RgSRSpheroid_WGS1984);
datum = new HorizontalDatum(ellipsoid, null, DatumType.HD_Geocentric, "World Geodetic System 1984", "EPSG", , String.Empty, "EPSG's WGS 84 datum has been the then current realisation. No distinction is made between the original WGS 84 frame, WGS 84 (G730), WGS 84 (G873) and WGS 84 (G1150). Since 1997, WGS 84 has been maintained within 10cm of the then current ITRF.", String.Empty);
break;
case (int)RgSRDatumType.RgSRDatum_Beijing1954:
IEllipsoid ellipsoid2 = this.CreateSpheroid((int)RgSRSpheroidType.RgSRSpheroid_Krasovsky1940);
datum = new HorizontalDatum(ellipsoid2, null, DatumType.HD_Geocentric, "D_Beijing1954", "EPSG", , String.Empty, "", String.Empty);
break;
case (int)RgSRDatumType.RgSRDatum_Xian1980:
IEllipsoid ellipsoid3 = this.CreateSpheroid((int)RgSRSpheroid2Type.RgSRSpheroid_Xian1980);
datum = new HorizontalDatum(ellipsoid3, null, DatumType.HD_Geocentric, "D_Xian1980", "EPSG", , String.Empty, "", String.Empty);
break;
}
return datum;
} public IGeographicCoordinateSystem CreateGeographicCoordinateSystem(int gcsType)
{
IGeographicCoordinateSystem gcs = null;
switch (gcsType)
{ case (int)RgSRGeoCSType.RgSRGeoCS_WGS1984:// WGS 1984.
List<AxisInfo> axes = new List<AxisInfo>();
axes.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
axes.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
IHorizontalDatum datum = this.CreateDatum((int)RgSRDatumType.RgSRDatum_WGS1984);
gcs = new GeographicCoordinateSystem(CoordinateSystems.AngularUnit.Degrees,
datum, CoordinateSystems.PrimeMeridian.Greenwich, axes,
"WGS1984", "EPSG", , String.Empty, string.Empty, string.Empty);
break;
case (int)RgSRGeoCSType.RgSRGeoCS_Beijing1954:
List<AxisInfo> axes2 = new List<AxisInfo>();
axes2.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
axes2.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
IHorizontalDatum datum2 = this.CreateDatum((int)RgSRDatumType.RgSRDatum_Beijing1954);
gcs = new GeographicCoordinateSystem(CoordinateSystems.AngularUnit.Degrees,
datum2, CoordinateSystems.PrimeMeridian.Greenwich, axes2,
"Beijing1954", "EPSG", , String.Empty, string.Empty, string.Empty);
break;
case (int)RgSRGeoCS3Type.RgSRGeoCS_Xian1980://Xian80.
List<AxisInfo> axes3 = new List<AxisInfo>();
axes3.Add(new AxisInfo("Lon", AxisOrientationEnum.East));
axes3.Add(new AxisInfo("Lat", AxisOrientationEnum.North));
IHorizontalDatum datum3 = this.CreateDatum((int)RgSRDatumType.RgSRDatum_Xian1980);
gcs = new GeographicCoordinateSystem(CoordinateSystems.AngularUnit.Degrees,
datum3, CoordinateSystems.PrimeMeridian.Greenwich, axes3,
"Xian1980", "EPSG", , String.Empty, string.Empty, string.Empty);
break; }
return gcs;
} public IProjectedCoordinateSystem CreateProjectedCoordinateSystem(int pcsType)
{
throw new NotImplementedException();
}
public IProjection CreateProjection(int projectionType)
{
switch (projectionType)
{
case (int)RgSRProjectionType.RgSRProjection_Albers:
break;
case (int)RgSRProjectionType.RgSRProjection_GaussKruger:
break;
case (int)RgSRProjectionType.RgSRProjection_Mercator:
break;
case (int)RgSRProjectionType.RgSRProjection_TransverseMercator:
break;
case (int)RgSRProjectionType.RgSRProjection_LambertConformalConic:
break;
}
return null;
}
}
}

SpatialReferenceEnvironmentClass

使用Proj.Net创建空间参考的更多相关文章

  1. ArcEngine 创建空间参考设置默认域

    ISpatialReferenceFactory3 spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); outSR = ...

  2. ArcGIS Engine开发之旅09--几何对象和空间参考

    原文:ArcGIS Engine开发之旅09--几何对象和空间参考 1.Geometry  Geometry 是 GIS 中使用最为广泛的对象集之一,用户在创建.删除.编辑和进行地理分析的时候,就是处 ...

  3. 空间参考系统与WKT解析

    空间参考系统与WKT解析 1.为什么要空间参考系统? 空间参考系统,也称为坐标系统.在GIS中为地理数据定位的基准,假设给你一个坐标(442281.875,4422651.589).如果不给你空间参考 ...

  4. ArcGIS for qml -关于空间参考如何选择设置

    作者: 狐狸家的鱼 Github: 八至 版权声明:如需转载请获取授权和联系作者 1.关于空间参考 空间参考可以通过众所周知的ID(WKID) - 整数值来引用. 官网指南中也有对此的专门说明 htt ...

  5. ArcGIS空间参考概述

    摘要:在地理数据库中,坐标系和其他相关空间属性被定义为各数据集的空间参考的一部分.空间参考是用于存储各要素类和栅格数据集,以及其他坐标属性(例如,x,y 坐标的坐标分辨率及可选的 z 坐标和测量 (m ...

  6. GIS空间参考及坐标转换

    空间参考(Spatial Reference)是 GIS 数据的骨骼框架,能够将我们的数据定位到相应的位置,为地图中的每一点提供准确的坐标. 在同一个地图上显示的地图数据的空间参考必须是一致的,如果两 ...

  7. ArcGIS api for javascript——设置自定义范围和空间参考

    描述 这个示例展示了在创建地图时如果定义一个自定义的范围和空间参考. 在 ArcGIS JavaScript API的1.0和1.1版本,任何要使用的地图服务图层都需要和地图的空间参考一致.1.2版本 ...

  8. ARCGIS切图:TPK文件的空间参考为地理坐标系

    先来吐槽一下,之前习惯了百度地图API,所以一直习惯直接将经纬度点添加到地图上进行显示,目前使用ARCGIS RUNTIME FOR ANDROID进行开发,在地图上加点需要原始点的坐标为投影坐标系, ...

  9. Openlayer3之空间参考扩展

    Openlayers默认了两种空间参考,一个是EPSG4326,一个是EPSG3857,其它的空间参考需要进行扩展才能使用.所以我们初始化时进行了如下操作: 1.将配置数据库中所有的空间参考读取出来, ...

随机推荐

  1. java web基础2HTTP协议知识点总结

    一.HTTP协议基础 1.定义:HTTP是基于TCP连接的浏览器与服务器通信协议.(即传输层先用TCP三次握手建立连接,进而HTTP通信) 2.连接原理:先进行TCP建立端到端连接,然后发送和接受HT ...

  2. what is php?

    PHP is a popular general-purpose scripting language that is especially suited to web development. Fa ...

  3. bug 发表文章不显示图片

    bug 描述: 现象是我们这不能发布图片, 测试说患教方向是可以正常发布图片的(还是要感激测试,正是他们鞭策我们不断挑战困难,解决之,从而提高自己姿势水平). 图片没上传上去, 服务端协助查找发现没调 ...

  4. Android 网络连接判断与处理

    Android网络连接判断与处理  获取网络信息需要在AndroidManifest.xml文件中加入相应的权限. <uses-permission android:name="and ...

  5. Bootstrap 图标菜单按钮组件

    ---恢复内容开始--- 一.小图标组件 Bootstrap 提供了免费的 263 个小图标(数了两次),具体可以参考中文官网的组件 链接:http://v3.bootcss.com/componen ...

  6. JS 去字符串空格 总结

    str为要去除空格的字符串: 去除所有空格: str = str.replace(/\s+/g,""); 去除两头空格: str = str.replace(/^\s+|\s+$/ ...

  7. python 之 range()

    range 是一个类,这个类用来实例化生成一个有序的整数序列. range类中定义了__iter__()特殊方法,说明range 类的实例对象都支持迭代. __len__()方法说明 range对象可 ...

  8. NDK编译FreeImage

    参考了 以下2篇文章 并作了一小点修改 http://recursify.com/blog/2013/05/25/building-freeimage-for-android http://blog. ...

  9. java不常用语法汇总(jdk1.6)

    1.浮点数省略的0 System.out.println(.5f); //.5和0.5等价. 2.import static引入一个static method后,可以在这个类中直接使用这个method ...

  10. 用字体在网页中画icon小图标

    HTML结构: <i class="icons icon-ui"> 㐺 <i> <i class="icons icon-ui"& ...