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中也有相关的坐标系的代码。
------------------------------------------------------------------------------------------------
一定要专业!本博客定位于 ,C语言,C++语言,Java语言,Android开发和少量的Web开发,之前是做Web开发的,其实就是ASP维护,发现EasyASP这个好框架,对前端后端数据库 都很感觉亲切啊。. linux,总之后台开发多一点。以后也愿意学习 cocos2d-x 游戏客户端的开发。