页首Html代码

返回顶部

ArcGIS AO 之投影坐标系的示例,点的投影ProjectPoint

在Arcgis Java SDK中,有许多例子,对于一个地图来讲,坐标系(空间参考)是非常重要的,他直接决定了一个点的坐标值是什么!所以这个示例是很基础的!特此粘贴

这个示例就是ProjectPoint 是Geometry中的示例,几何处理。一下省略了Engine的init和关闭,需要Engine和ArcView许可。


  System.out.println("Starting ProjectPoint - An ArcObjects Java SDK Developer Sample");
// Create a point with Geographic coordinates... Point point = new Point(); point.putCoords(-100.0, 40.0); System.out.println("Original coordinates: " + point.getX() + "," + point.getY()); // Create the SpatialReferenceEnvironment... SpatialReferenceEnvironment spatialReferenceEnvironment = new SpatialReferenceEnvironment(); // Apply the initial spatial reference... ISpatialReference geographicCoordinateSystem = spatialReferenceEnvironment .createGeographicCoordinateSystem(esriSRGeoCSType.esriSRGeoCS_NAD1927); point.setSpatialReferenceByRef(geographicCoordinateSystem); // Create the output projected coordinate system... ISpatialReference projectedCoordinateSystem = spatialReferenceEnvironment .createProjectedCoordinateSystem(esriSRProjCSType.esriSRProjCS_NAD1983UTM_13N); // Create the GeoTransformation... IGeoTransformation iGeoTransformation = (IGeoTransformation) spatialReferenceEnvironment .createGeoTransformation(esriSRGeoTransformationType.esriSRGeoTransformation_NAD1927_To_WGS1984_5); // Project the point... point.projectEx(projectedCoordinateSystem, esriTransformDirection.esriTransformForward, iGeoTransformation, false, 0.0, 0.0); System.out.println("Projected coordinates: " + point.getX() + " , " + point.getY()); System.out.println("Done!");

比较重要的坐标系就是WGS1984和中国特有的beijing1954和xian1980,在esriSRGeoCSType中没有xian的关键字,有俩GRS1980和OSSN1980不知道是不是

com.esri.arcgis.geometry.esriSRGeoCSType.esriSRGeoCS_Beijing1954= 4214;

com.esri.arcgis.geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984 =4326;

  public static final int esriSRGeoCS_GRS1980 = 4019;
  public static final int esriSRGeoCS_OSSN1980 = 4279;

 在esriSRPrjCSType中也有相关的坐标系的代码。

 

 

posted @ 2012-05-08 17:06  ayanmw  阅读(1618)  评论(0编辑  收藏  举报

页脚Html代码