Java中不同地图投影之间的转换

发布于 2024-10-12 21:36:47 字数 606 浏览 7 评论 0原文

在我的 GIS 应用程序中,数据有时存储在“Google Mercator”(以米为单位)中,有时存储在 WGS84 LatLon 中。 我想要一个可靠的库来轻松地以“科学”的方式转换这些数据,而不是手动弄乱它,冒着大错误的风险。

我遇到过 Proj4,它显然能够做到这一点:http://trac .osgeo.org/proj

但我找不到类似的 Java(或 Groovy)库。 鉴于这些预测在在线应用程序中越来越常见,这样的项目将非常有益。一个小罐子就太棒了:-)

有一个 Java 端口,但没有任何文件可供下载: http://www.jhlabs.com/java/maps/proj/

基本上我需要进行这种类型的转换: http://proj4js.org

知道如何在 Java 中执行此操作吗?

谢谢, 穆隆

In my GIS application the data are sometimes stored in "Google Mercator" (in meters), sometimes in WGS84 LatLon.
I'd like a reliable library to convert this data easily and in a "scientific" way, rather than messing with it manually, risking big errors.

I've come across Proj4, which apparently is able to do this: http://trac.osgeo.org/proj

but I can't find a similar library for Java (or Groovy).
Such a project would be highly beneficial, given that those projections are increasingly common in online applications. A little jar would be amazing :-)

There is a Java port, but there aren't any files to download: http://www.jhlabs.com/java/maps/proj/

Basically I need to do this type of conversion: http://proj4js.org

Any idea about how to do this in Java?

Thanks,
Mulone

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白云不回头 2024-10-19 21:36:47

查看 GeoTools。糟糕的是你得到的不是一个小罐子,而是大约一百个。

本教程可能会显示类似的内容你想要完成什么。

Have a look at GeoTools. The bad thing is you don't get a little jar, but about a hundred.

This Tutorial might show something similiar to what you want to accomplish.

吃→可爱长大的 2024-10-19 21:36:47

我还推荐 GeoTools:查看 CRS 类:

http://docs .geotools.org/latest/userguide/library/referencing/crs.html

使用 Maven:

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-api</artifactId>
      <version>8-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-referencing</artifactId>
        <version>8-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-epsg-hsql</artifactId>
        <version>8-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-epsg-extension</artifactId>
        <version>${version.geotools}</version>
    </dependency>

gt-epsg-hsql 基本上包含一个 HSQL 数据库,其中已经加载了 CRS 定义。但是,您也可以使用 WKT 手动加载定义:

CRS.parseWKT( txt )

这意味着您可以跳转到 http://spatialreference.org/,获取 OGC WKT 定义并将其插入。

此外,如果您喜欢走这条路,Proj4 确实有 JNI 绑定。

I would also recommend GeoTools: look at the CRS class:

http://docs.geotools.org/latest/userguide/library/referencing/crs.html

Using Maven:

    <dependency>
      <groupId>org.geotools</groupId>
      <artifactId>gt-api</artifactId>
      <version>8-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-referencing</artifactId>
        <version>8-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-epsg-hsql</artifactId>
        <version>8-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-epsg-extension</artifactId>
        <version>${version.geotools}</version>
    </dependency>

The gt-epsg-hsql basically included a HSQL database with a load of CRS definitions already loaded. However, you can also manually load definitions using WKT:

CRS.parseWKT( txt )

This means you can pop on over to http://spatialreference.org/, grab an OGC WKT definition and plumb it in.

Also, Proj4 does have JNI bindings if you fancy going that route.

橘寄 2024-10-19 21:36:47

JH Labs 的 Java 端口现在由俄勒冈州立大学制图和地理可视化小组维护,现已发布在 GitHub 上:
https://github.com/OSUCartography/JMapProjLib

Java port by JH Labs, now maintained by the Cartography and Geovisualization Group, Oregon State University is now on GitHub:
https://github.com/OSUCartography/JMapProjLib

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文