问题
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.
GDAL looks promising, but as far as I can tell there won't be Java bindings until "sometime" in the future.
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.
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...
回答1:
GeoTools is a good bet for this. The Google Maps Terms of Service prohibit 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.
回答2:
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.
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.
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?).
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.
Disclaimer I am on the steering committee for GeoTools, and uDig.
回答3:
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 SDK is 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.
回答4:
OpenMap is supposedly pretty good.
Warning: the "open" license they use is considered non-free by Fedora and GNU.
回答5:
I have used MapXtreme for Java, it was pretty good and supported several formats. It is not cheap but it delivers.
It is geared towards rendering vectorial data formats.
You can use it either server or client side.
回答6:
Try mapscript for java www.mapserver.org
CU
回答7:
Have a look at UDig
http://udig.refractions.net/
It is based on the eclipse RCP works with Geotools and can display most types of spatial data.
it is open source and seems to have quite a bit of activity
回答8:
ArcGIS Engine Java will 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.
回答9:
It doesn't handle all the formats you mention but I was successful displaying Web maps using modestmaps for Processing (find it here). A processing PApplet can be embedded in a swing GUI as explained here.
回答10:
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.
来源:https://stackoverflow.com/questions/895653/java-equivalent-of-openlayers