java - 如何使用 PROJ.4 将坐标从 WGS84 转换为投影坐标?

标签 java wgs84 map-projections proj4js proj

我在 WGS84 中有一个 GPS 坐标,我想使用 PROJ.4 将其转换为 SWEREF99 TM 中的 map 投影坐标。在 Java 或 Proj4js在 JavaScript 中。

很难找到 PROJ.4 的文档以及如何使用它。如果您有好的链接,请将其作为评论发布。

SWEREF99 TM 的 PROJ.4 参数是 +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

我尝试使用 PROJ.4 Java library用于转换 Lat: 55° 00’ N, Long: 12° 45’ E 并尝试使用此代码:

String[] proj4_w = new String[] {
 "+proj=utm",
 "+zone=33",
 "+ellps=GRS80",
 "+towgs84=0,0,0,0,0,0,0",
 "+units=m",
 "+no_defs"
};

Projection proj = ProjectionFactory.fromPROJ4Specification(proj4_w);  

Point2D.Double testLatLng = new Point2D.Double(55.0000, 12.7500);
Point2D.Double testProjec = proj.transform(testLatLng, new Point2D.Double());

这给了我点 Point2D.Double[5197915.86288144, 1822635.9083898761] 但我应该是 N: 6097106.672, E: 356083.438 我做错了什么?我应该改用什么方法和参数?

正确的值取自 Lantmäteriet .

我不确定 proj.transform(testLatLng, new Point2D.Double()); 是否是正确的使用方法。

最佳答案

55是纬度还是经度?

编辑:看来您应该简单地交换纬度和经度参数。

EDIT2:即

 Point2D.Double testLatLng = new Point2D.Double(12.7500, 55.0000); 

关于java - 如何使用 PROJ.4 将坐标从 WGS84 转换为投影坐标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2469583/

相关文章:

coordinates - 将本地平面坐标转换为 WGS84 的概述

ios - IOS 外部 GPS 数据的 WGS84 Geoid Height Altitude Offset

javascript - 为谷歌地图 v3 JS Latlng 对象转换 DATUM WGS84 坐标

c++ - 从纬度和经度计算屏幕位置

r - 如何将经纬度网格添加到投影 map ?

java - 智能 : Class not found: "" Empty test suite

c# - 作为一名熟练的 c# 程序员,Java 类型参数推理规则中有哪些陷阱在等着我?

java - FileReader 找不到我的文本文件

google-maps - Google Maps API 中的其他投影?

java - 使用 SSL 证书触发器运行 Tomcat 服务器无法找到或加载主类 cert.pkcs12