如何使用PROJ.4将坐标从WGS84转换为投影中的坐标? [英] How to transform coordinate from WGS84 to a coordinate in a projection with PROJ.4?

查看:3375
本文介绍了如何使用PROJ.4将坐标从WGS84转换为投影中的坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WGS84中有一个GPS坐标,我想使用 PROJ.4 或JavaScript中的 Proj4js

I have a GPS-coordinate in WGS84 that I would like to transform to a map-projection coordinate in SWEREF99 TM using PROJ.4 in Java or Proj4js in JavaScript.

很难找到 PROJ.4 的文档以及如何使用它。如果你有一个很好的链接,请发表评论。

Its hard to find documentation for PROJ.4 and how to use it. If you have a good link, please post it as a comment.

SWEREF99 TM + proj = utm + zone = 33 + ellps = GRS80 + towgs84 = 0,0,0,0, 0,0,0 +单位= m + no_defs

我试图使用 PROJ.4 Java库用于转换 Lat:55°00'N,长:12°45'E 并尝试使用此代码:

I have tried to use a PROJ.4 Java library for transforming Lat: 55° 00’ N, Long: 12° 45’ E and tried with this code:

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()); 是正确的使用方法。

I am not sure if proj.transform(testLatLng, new Point2D.Double()); is the right method to use.

推荐答案

55是纬度还是经度?

55 is latitude or longitude?

编辑:看起来你应该简单地交换lat和long参数。

it seems you should simply swap lat and long parameters.

EDIT2:ie

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

这篇关于如何使用PROJ.4将坐标从WGS84转换为投影中的坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆