坐标变换
Java 是否存在任何开源或“免费”库,我可以在其中执行从一个空间系统到另一个空间系统的坐标转换?
我发现了 Opengeo http://opengeo.org/ 但它是一个庞大而全面的库,适用于各种空间事物。
还有更小的东西存在吗?我需要从 MGA56 转换为 WGS84。
Do any open source or 'free' libraries exist for Java where i can perform coordinate transforms from one spatial system to another?
I found Opengeo http://opengeo.org/ but it's a huge and comprehensive library for all sorts of spatial things.
Does anything smaller exist? I need to convert from MGA56 to WGS84.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我需要在 WGS84(GPS 投影)和 EPSG 27700(英国国家电网)之间来回转换,我发现 geotrellis 库最准确、最可用。它是用 Scala 编写的,但显然您可以在 Java 中使用该库。这是我使用的 Maven 依赖项:
这是一些示例代码:
它会产生以下输出:
I've needed to convert back and forwards between WGS84 (the GPS projection) and EPSG 27700 (UK National Grid) and I've found the geotrellis library most accurate and usable. It's written in Scala but obviously you can use the library in Java. Here's the maven dependency I've used:
and this is some example code:
which produces this output:
有一个完全用 Java 编写的轻量级库。
坐标变换套件(缩写 CTS)是一个为使用众所周知的大地测量算法和参数集执行坐标变换而开发的库。
CTS 处理 4257 个坐标参考系统 (3910 EPSG)。
本项目源码位于:
https://github.com/irstv/CTS
There is a lightweight library written fully in Java.
Coordinate Transformation Suite (abridged CTS) is a library developed to perform coordinate transformations using well known geodetic algorithms and parameter sets.
CTS handles 4257 coordinate reference systems (3910 EPSG).
The source code of this project is located at:
https://github.com/irstv/CTS
一个简单的解决方案是 PROJ.4,但它没有 Java 绑定,因此可以使用它可能有点棘手。更完整(但可能比您想要的更大)的解决方案是 GeoTools。但快速搜索发现了Java Map Projection Library,它似乎是一个Java PROJ.4 的端口。我会尝试一下。
由于看来您需要进行基准平移,而不仅仅是投影,因此您将需要某种坐标系数据库。最容易获得的是 EPSG 数据库——PROJ.4 附带了一个 EPSG 映射文件,该文件对于大多数用途来说应该足够了。
看起来 MGA56 是 EPSG:28356,当然 WGS84 是 EPSG:4326。
A simple solution is PROJ.4, but it doesn't have Java bindings, so working with it might be a bit tricky. A more complete (but probably bigger than you want) solution would be GeoTools. But a quick search found the Java Map Projection Library, which appears to be a Java port of PROJ.4. I would give that a try.
Since it appears you need to do a datum shift, not only a projection, you will need to have some kind of coordinate system database. The easiest to get a hold of is the EPSG database -- PROJ.4 comes with an EPSG mapping file, which should be good enough for most purposes.
It looks like MGA56 is EPSG:28356, and of course WGS84 is EPSG:4326.