相当于 OpenLayers 的 Java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/895653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java equivalent of OpenLayers
提问by dave4351
I am looking for a Java library to display map data from various sources, including shapefile, WMS, WFS, Google Maps, possibly ArcIMS, etc. It seems like OpenLayers is the closest thing to what I want, except it's a JavaScript library, and I'm writing a Swing application.
我正在寻找一个 Java 库来显示来自各种来源的地图数据,包括 shapefile、WMS、WFS、谷歌地图,可能是 ArcIMS 等。似乎 OpenLayers 是最接近我想要的东西,除了它是一个 JavaScript 库,并且我正在编写一个 Swing 应用程序。
GDAL looks promising, but as far as I can tell there won't be Java bindings until "sometime" in the future.
GDAL 看起来很有希望,但据我所知,直到未来“某个时候”才会有 Java 绑定。
Just to be clear, I am looking for a single Java API that I can use to display maps from a number of map servers/sources.
明确地说,我正在寻找一个 Java API,我可以用它来显示来自多个地图服务器/源的地图。
Does anyone know if anything like this exists, and if not, where to go from here? Should I build this API on top of GeoTools? Or...
有谁知道这样的事情是否存在,如果不存在,从哪里开始?我应该在 GeoTools 之上构建这个 API 吗?或者...
采纳答案by David Winslow
GeoTools is a good bet for this. The Google Maps Terms of Serviceprohibit accessing Google Maps tiles except through the (JavaScript) Google Maps API, so it's not likely that you'll find a freely available codebase to access them in a Java application. Similar restrictions probably apply to other commercial layers.
GeoTools 是一个很好的选择。谷歌地图服务条款禁止访问谷歌地图图块,除非通过 (JavaScript) 谷歌地图 API,因此您不太可能找到免费可用的代码库来在 Java 应用程序中访问它们。类似的限制可能适用于其他商业层。
回答by Jody Garnett
This is a case where you have lots of choice. GeoTools is indeed a low level library and an excellent choice for some hands on work. We recently started using Swing for our example code in order to make tutorials more visual. That said they are tutorial code only and do not represent a multi threaded system such as uDig.
在这种情况下,您有很多选择。GeoTools 确实是一个低级库,是一些动手工作的绝佳选择。我们最近开始将 Swing 用于我们的示例代码,以使教程更加直观。也就是说,它们只是教程代码,并不代表像 uDig 这样的多线程系统。
If you are looking for Swing applications to start form there is the Jump family (sadly scattered through a closed development process - OpenJump represents a collection of the various forks), gvSig which has excellent financial backing in Span, and so on.
如果您正在寻找开始形式的 Swing 应用程序,则有 Jump 系列(遗憾地分散在封闭的开发过程中 - OpenJump 代表各种分支的集合)、在 Span 中具有出色财务支持的 gvSig,等等。
You may also wish to look at the library side of the deegree project (which I seem to recall produced a desktop application as well?).
您可能还希望查看 deegree 项目的库方面(我似乎记得它也生成了一个桌面应用程序?)。
I also recommend looking at some of the tiled map viewers produced around Nasa World Wind and Open Street Map datasets. These will be more similar to the OpenLayers experience.
我还建议查看一些围绕 Nasa World Wind 和 Open Street Map 数据集制作的平铺地图查看器。这些将更类似于 OpenLayers 体验。
Disclaimer I am on the steering committee for GeoTools, and uDig.
免责声明 我是 GeoTools 和 uDig 的指导委员会成员。
回答by DavidValeri
uDig would probably meet your needs just fine if you can work within the RCP framework. I don't have any experience with uDig or NASA World Wind, but if you need to put the map features in an existing application, NASA's World Wind Java SDKis another option. It is extensible and supports industry standards for geospatial data. They have an informative wiki here. I first saw NASA World Wind at JavaOne 2007 and it doesn't look like the Java SDK has really taken off nor does it look like the .Net version is seeing a lot of new releases, but it could meet your needs if they are basic.
如果您可以在 RCP 框架内工作,uDig 可能会很好地满足您的需求。我没有任何使用 uDig 或 NASA World Wind 的经验,但如果您需要将地图功能放在现有应用程序中,NASA 的 World Wind Java SDK是另一种选择。它是可扩展的并支持地理空间数据的行业标准。他们在这里有一个信息丰富的 wiki 。我第一次在 JavaOne 2007 上看到 NASA World Wind,看起来 Java SDK 并没有真正起飞,.Net 版本也没有看到很多新版本,但是如果它们是基本的,它可以满足您的需求.
回答by Leif Gruenwoldt
回答by Vladtn
It doesn't handle all the formats you mention but I was successful displaying Web maps using modestmapsfor Processing(find it here). A processing PApplet can be embedded in a swing GUI as explained here.
它不能处理您提到的所有格式,但我成功地使用用于处理的适度地图显示 Web 地图(在此处找到)。一种处理PApplet可以嵌入在摆动GUI所解释这里。
回答by xmedeko
You can use GoogleMaps if you can embed a Web browser into your Java swing application, try JDIC or DJ Project. Also see Is there a way to embed a browser in Java?I have been working with such solution in C# - embedding IE. However, you must embed a good web browser, usually some native web browser and this limits your such solution.
如果您可以将 Web 浏览器嵌入 Java Swing 应用程序,则可以使用 GoogleMaps,试试 JDIC 或 DJ Project。另请参阅有没有办法在 Java 中嵌入浏览器?我一直在使用 C# 中的这种解决方案 - 嵌入 IE。但是,您必须嵌入一个好的 Web 浏览器,通常是一些本机 Web 浏览器,这限制了您的此类解决方案。
回答by Mario Ortegón
I have used MapXtreme for Java, it was pretty good and supported several formats. It is not cheap but it delivers.
我已经使用MapXtreme for Java,它非常好并且支持多种格式。它并不便宜,但它提供。
It is geared towards rendering vectorial data formats.
它面向呈现矢量数据格式。
You can use it either server or client side.
您可以在服务器端或客户端使用它。
回答by Mario Ortegón
Try mapscript for java www.mapserver.org
尝试 java www.mapserver.org 的 mapscript
CU
CU
回答by flurbius
Have a look at UDig
看看 UDig
It is based on the eclipse RCP works with Geotools and can display most types of spatial data.
它基于eclipse RCP 与Geotools 配合使用,可以显示大多数类型的空间数据。
it is open source and seems to have quite a bit of activity
它是开源的,似乎有相当多的活动
回答by James Schek
ArcGIS Engine Javawill do what you need. It integrates into a fully-integrated GIS platform. There are tools to create cartographic quality maps, publish them, host them out, or to build custom apps.
ArcGIS Engine Java将满足您的需求。它集成到一个完全集成的 GIS 平台中。有一些工具可以创建制图质量地图、发布地图、托管地图或构建自定义应用程序。

