Jon*_*nas 9 java wgs84 proj map-projections proj4js
我在WGS84,我想转变为一个地图投影使用SWEREF99 TM协调GPS坐标PROJ.4在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库进行转换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());
Run Code Online (Sandbox Code Playgroud)
这给了我一点,Point2D.Double[5197915.86288144, 1822635.9083898761]但我应该N: 6097106.672, E: 356083.438
是我做错了什么?我应该使用什么方法和参数呢?
正确的值取自Lantmäteriet.
我不确定是否proj.transform(testLatLng, new Point2D.Double());使用正确的方法.
55是纬度还是经度?
编辑:看来你应该简单地交换纬度和经度参数。
编辑2:即
Point2D.Double testLatLng = new Point2D.Double(12.7500, 55.0000);
Run Code Online (Sandbox Code Playgroud)