proj4经纬度bl转换xy_如何使用PROJ.4将坐标从WGS84转换为投影中的坐标?

本文介绍了如何使用PROJ.4库在Java或JavaScript中将GPS坐标从WGS84投影到SWEREF99 TM地图投影。遇到的问题是转换后的坐标不正确,经过编辑确认,需要交换经度和纬度的输入顺序。
摘要由CSDN通过智能技术生成

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.

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.

The PROJ.4 parameters for SWEREF99 TM is +proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

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());

This give me the point Point2D.Double[5197915.86288144, 1822635.9083898761] but I should be N: 6097106.672, E: 356083.438

What am I doing wrong? and what method and parameters should I use instead?

The correct values is taken from Lantmäteriet.

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

解决方案

55 is latitude or longitude?

EDIT: it seems you should simply swap lat and long parameters.

EDIT2: i.e.

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值