使用Proj.Net创建空间参考
在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创建空间参考的更多相关文章
- ArcEngine 创建空间参考设置默认域
ISpatialReferenceFactory3 spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); outSR = ...
- ArcGIS Engine开发之旅09--几何对象和空间参考
原文:ArcGIS Engine开发之旅09--几何对象和空间参考 1.Geometry Geometry 是 GIS 中使用最为广泛的对象集之一,用户在创建.删除.编辑和进行地理分析的时候,就是处 ...
- 空间参考系统与WKT解析
空间参考系统与WKT解析 1.为什么要空间参考系统? 空间参考系统,也称为坐标系统.在GIS中为地理数据定位的基准,假设给你一个坐标(442281.875,4422651.589).如果不给你空间参考 ...
- ArcGIS for qml -关于空间参考如何选择设置
作者: 狐狸家的鱼 Github: 八至 版权声明:如需转载请获取授权和联系作者 1.关于空间参考 空间参考可以通过众所周知的ID(WKID) - 整数值来引用. 官网指南中也有对此的专门说明 htt ...
- ArcGIS空间参考概述
摘要:在地理数据库中,坐标系和其他相关空间属性被定义为各数据集的空间参考的一部分.空间参考是用于存储各要素类和栅格数据集,以及其他坐标属性(例如,x,y 坐标的坐标分辨率及可选的 z 坐标和测量 (m ...
- GIS空间参考及坐标转换
空间参考(Spatial Reference)是 GIS 数据的骨骼框架,能够将我们的数据定位到相应的位置,为地图中的每一点提供准确的坐标. 在同一个地图上显示的地图数据的空间参考必须是一致的,如果两 ...
- ArcGIS api for javascript——设置自定义范围和空间参考
描述 这个示例展示了在创建地图时如果定义一个自定义的范围和空间参考. 在 ArcGIS JavaScript API的1.0和1.1版本,任何要使用的地图服务图层都需要和地图的空间参考一致.1.2版本 ...
- ARCGIS切图:TPK文件的空间参考为地理坐标系
先来吐槽一下,之前习惯了百度地图API,所以一直习惯直接将经纬度点添加到地图上进行显示,目前使用ARCGIS RUNTIME FOR ANDROID进行开发,在地图上加点需要原始点的坐标为投影坐标系, ...
- Openlayer3之空间参考扩展
Openlayers默认了两种空间参考,一个是EPSG4326,一个是EPSG3857,其它的空间参考需要进行扩展才能使用.所以我们初始化时进行了如下操作: 1.将配置数据库中所有的空间参考读取出来, ...
随机推荐
- 7. Add a networking service
Controller Node: 1. sudo vi /etc/nova/nova.conf [DEFAULT] ... network_api_class = nova.network.api.A ...
- 来到这里,我放弃了多少- UI基础-疯狂猜图,我们都疯狂了-
小问题也要问 学习最重要的是 自律 我昨天晚上3点睡的, 这两天一点也没睡 0.99*0.99 每天差一点 日积月累就很多了 关键字,在字典里查一下,在类里面查查 瑞详博客下载器 跑步后精神多了,白 ...
- flat file
Computer Science An Overview _J. Glenn Brookshear _11th Edition The term database refers to a collec ...
- P2672 推销员
贪心,水题 #include <bits/stdc++.h> using namespace std; const int maxn = 1000000; struct house { i ...
- android ListView详解继承ListActivity
[转]http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html 在android开发中ListView是比较常用的组件,它以列表的形式展 ...
- Nginx的配置中与流量分发相关的配置规范:
1.除首页外,其他页面都在某个目录中首页可以直接在根目录下,其他页面都要在根目录下的目录中.不同的location尽量使用第一个dir的模式进行区分,便于区分该流量是落在nginx本地,还是转发到后端 ...
- MessageQueue 一 简单的创建和读取
创建一个队列,并写入数据 在读取出来 using System; using System.Collections.Generic; using System.Linq; using System.M ...
- 【译】Android系统架构
让我们来快速预览一下整个android系统的架构.从下面的图中我们可以发现,这个架构分为几个不同的层,底层为上一层提供服务. Linux Kernel android系统建立在一个坚固的基石上:Li ...
- Oozie协作框架
一:概述 1.大数据协作框架 2.Hadoop的任务调度 3.Oozie的三大功能 Oozie Workflow jobs Oozie Coordinator jobs Oozie Bundle 4. ...
- ZooKeeper Recipes and Solutions 翻译
ZooKeeper 秘诀 与解决方案 A Guide to Creating Higher-level Constructs with ZooKeeper Out of the Box Applica ...