使用Java和任何外部库,如何将纬度/经度点绘制到地球的图形表示中?

时间:2021-01-15 16:01:37

I'm currently using the Java Map Projection Library (I was able to obtain the code used for the Applet from the author and modify it for use in a desktop application - not sure if he linked to that on his website yet) to draw a map of the Earth in an application. However, I want to take this a step further. I have a set of latitude/longitude points that I want to plot on this map - I just need to draw a circle at each point and perhaps some lines connecting the circles (points) on the map. However, as the user uses the built-in panning and zooming capabilities, the points need to be redrawn in the proper position. The best I have been able to achieve is maintaining the points when zooming, and even then the points get larger as you zoom in.

我目前正在使用Java Map Projection Library(我能够从作者那里获取用于Applet的代码并将其修改为在桌面应用程序中使用 - 不确定他是否与他的网站上的链接相关)来绘制应用程序中的地球地图。但是,我想更进一步。我有一组我想在这张地图上绘制的纬度/经度点 - 我只需要在每个点画一个圆圈,也许需要在地图上画一些连接圆圈(点)的线条。但是,由于用户使用内置的平移和缩放功能,需要在正确的位置重绘点。我能够实现的最好的是在缩放时保持点数,即使这样,在放大时点也会变大。

I'm totally open to switching libraries, however I really haven't found a library that can take care of drawing a world map, particularly onto a Swing component (it doesn't need to be that accurate, just show the various landmasses somewhat correctly) and also plotting additional points on top of that map and having them "stick" to various latitude/longitude coordinates.

我完全愿意切换库,但是我真的没有找到一个可以处理世界地图的库,特别是在Swing组件上(它不需要那么准确,只是在某种程度上展示各种大陆)正确地)并且还在该地图的顶部绘制附加点并使它们“粘”到各种纬度/经度坐标。

I have looked at Google Earth and NASA WorldWind, however they are awfully heavy for my purposes (I don't need anything that detailed or accurate) and it doesn't seem that easy to allow for offline use and integrate the world image view into an existing application.

我看过谷歌地球和NASA WorldWind,但它们对我的目的来说非常沉重(我不需要任何详细或准确的东西)并且它似乎不容易离线使用并将世界图像视图集成到现有的申请。

Suggestions or thoughts?

建议还是想法?

5 个解决方案

#1


You might take a look at other components of the www.osgeo.org Java stack. One of them is geotools: http://geotools.codehaus.org/

您可以查看www.osgeo.org Java堆栈的其他组件。其中一个是geotools:http://geotools.codehaus.org/

they is also development going on to create a GUI: http://geotools.codehaus.org/GUI+Architecture

他们还在开发创建GUI:http://geotools.codehaus.org/GUI+Architecture

#2


While I haven't used it, the SwingLabs SwingX-WS project has a "rich map viewer component." There's a tutorial for getting started with the map component on the Java.net page.

虽然我还没有使用它,但SwingLabs SwingX-WS项目有一个“丰富的地图查看器组件”。有一个关于Java.net页面上的map组件入门的教程。

#3


Dealing with geospatial data can get VERY tricky quickly. What approach to take depends a lot on how accurate you need to be when displaying the data. GIS for Web Developers is a great book that covers the issues with geospatial data and how to get it from the data source onto the display. It is geared to web-based displays, but the concepts are the same.

处理地理空间数据可能会非常棘手。采取什么方法取决于显示数据时您需要多准确。 GIS for Web Developers是一本很好的书,它涵盖了地理空间数据的问题以及如何将数据源从数据源传输到显示器上。它适用于基于Web的显示,但概念是相同的。

If you do not need a high degree of accuracy a simple approach is to find an unprojected base map. With a base map it is easy to display lat/long points using simple Cartesian coordinates.

如果您不需要高度准确,一个简单的方法是找到未投影的基本地图。使用基本地图,可以使用简单的笛卡尔坐标轻松显示纬度/经度。

If you do need an accurate display then there really isn't a way to avoid the pretty complex libraries. There is a LOT of math involved in converting geospatial data with different datums and projections into something that can be displayed to users.

如果你确实需要一个准确的显示,那么真的没有办法避免相当复杂的库。将具有不同基准和投影的地理空间数据转换为可以向用户显示的内容涉及大量数学。

#4


You should look at OpenMap.

你应该看看OpenMap。

We have been using OpenMap to display GPS tracks in desktop applications for a few years. Its really pretty easy to add your own layers for the track points, history, annotations, and your own data sources. You don't need to have any external connections if you don't want it to have them.

几年来,我们一直使用OpenMap在桌面应用程序中显示GPS轨迹。为跟踪点,历史记录,注释和您自己的数据源添加自己的图层非常容易。如果您不希望它拥有它们,则不需要任何外部连接。

I looked quickly at GeoTools, but it seemed like getting started, at least a year or two ago was more complex than what we had already accomplished with OpenMap. We've been recently exploring WorldWind, but it definitely way more that we needed. OpenMap requires little in horsepower versus WorldWind which needs pretty decent video card.

我很快就看了GeoTools,但似乎开始,至少一两年前比我们已经完成的OpenMap更复杂。我们最近一直在探索WorldWind,但它绝对是我们所需要的。与需要相当不错的视频卡的WorldWind相比,OpenMap几乎不需要马力。

#5


I used OpenMap for an little app some time back - it's a hack, but shows how to do it. The app shows hurricane tracks from various years using data from NOAA. You can download it from here:

我曾经在一段时间内使用OpenMap做一个小应用程序 - 这是一个黑客,但显示了如何做到这一点。该应用程序使用NOAA的数据显示了不同年份的飓风轨迹。你可以在这里下载:

http://github.com/DonBranson/SnarfNOAA

#1


You might take a look at other components of the www.osgeo.org Java stack. One of them is geotools: http://geotools.codehaus.org/

您可以查看www.osgeo.org Java堆栈的其他组件。其中一个是geotools:http://geotools.codehaus.org/

they is also development going on to create a GUI: http://geotools.codehaus.org/GUI+Architecture

他们还在开发创建GUI:http://geotools.codehaus.org/GUI+Architecture

#2


While I haven't used it, the SwingLabs SwingX-WS project has a "rich map viewer component." There's a tutorial for getting started with the map component on the Java.net page.

虽然我还没有使用它,但SwingLabs SwingX-WS项目有一个“丰富的地图查看器组件”。有一个关于Java.net页面上的map组件入门的教程。

#3


Dealing with geospatial data can get VERY tricky quickly. What approach to take depends a lot on how accurate you need to be when displaying the data. GIS for Web Developers is a great book that covers the issues with geospatial data and how to get it from the data source onto the display. It is geared to web-based displays, but the concepts are the same.

处理地理空间数据可能会非常棘手。采取什么方法取决于显示数据时您需要多准确。 GIS for Web Developers是一本很好的书,它涵盖了地理空间数据的问题以及如何将数据源从数据源传输到显示器上。它适用于基于Web的显示,但概念是相同的。

If you do not need a high degree of accuracy a simple approach is to find an unprojected base map. With a base map it is easy to display lat/long points using simple Cartesian coordinates.

如果您不需要高度准确,一个简单的方法是找到未投影的基本地图。使用基本地图,可以使用简单的笛卡尔坐标轻松显示纬度/经度。

If you do need an accurate display then there really isn't a way to avoid the pretty complex libraries. There is a LOT of math involved in converting geospatial data with different datums and projections into something that can be displayed to users.

如果你确实需要一个准确的显示,那么真的没有办法避免相当复杂的库。将具有不同基准和投影的地理空间数据转换为可以向用户显示的内容涉及大量数学。

#4


You should look at OpenMap.

你应该看看OpenMap。

We have been using OpenMap to display GPS tracks in desktop applications for a few years. Its really pretty easy to add your own layers for the track points, history, annotations, and your own data sources. You don't need to have any external connections if you don't want it to have them.

几年来,我们一直使用OpenMap在桌面应用程序中显示GPS轨迹。为跟踪点,历史记录,注释和您自己的数据源添加自己的图层非常容易。如果您不希望它拥有它们,则不需要任何外部连接。

I looked quickly at GeoTools, but it seemed like getting started, at least a year or two ago was more complex than what we had already accomplished with OpenMap. We've been recently exploring WorldWind, but it definitely way more that we needed. OpenMap requires little in horsepower versus WorldWind which needs pretty decent video card.

我很快就看了GeoTools,但似乎开始,至少一两年前比我们已经完成的OpenMap更复杂。我们最近一直在探索WorldWind,但它绝对是我们所需要的。与需要相当不错的视频卡的WorldWind相比,OpenMap几乎不需要马力。

#5


I used OpenMap for an little app some time back - it's a hack, but shows how to do it. The app shows hurricane tracks from various years using data from NOAA. You can download it from here:

我曾经在一段时间内使用OpenMap做一个小应用程序 - 这是一个黑客,但显示了如何做到这一点。该应用程序使用NOAA的数据显示了不同年份的飓风轨迹。你可以在这里下载:

http://github.com/DonBranson/SnarfNOAA