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

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

很难找到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库来转换Lat: 55° 00' N, Long: 12° 45' E 00’N Lat: 55° 00' N, Long: 12° 45' E 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是纬度还是经度?

编辑:似乎你应该简单地交换lat和long参数。

EDIT2:即

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