Java API for Google Maps (or similar)

I was wondering if there is a Java library that acts as a wrapper for the Google Maps API. What I am interested in is displaying a satellite map of a specific region (lon, lat) on my desktop application. It doesn't have to be Google Maps specifically, any map service would do the trick.

What I need though is a library to work with a desktop client, no javascript, GWT etc.

Any ideas?

Answers


If you are just looking to display a satellite map image for a specific latitude longitude (without the google maps panning/zooming etc), then you should check out Google Static Maps.

You just need to build a URL string, then make an HTTP request (from your java implementation) for the image (in whatever format you like). You can specify a whole bunch of parameters in the URL to get the satellite image you are after:

From the URL:

http://maps.google.com/staticmap?center=40,26&zoom=1&size=150x112&maptype=satellite&key=ABQIAAAAgb5KEVTm54vkPcAkU9xOvBR30EG5jFWfUzfYJTWEkWk2p04CHxTGDNV791-cU95kOnweeZ0SsURYSA&format=jpg

EDIT: Ok, I actually deleted this answer because I discovered section 10.8 in the TOS explicitly forbids accessing static maps from outside a browser. But then I discovered this FAQ update which seems to allow it. I might ask a Google person and get the final word.

EDIT: Thanks Paracycle, not sure if that is a new addition to the FAQ, but in any case it is pretty explicit, you are not allowed to do this.


Google maps does not allow for using it's images in desktop applications. Microsoft has a collaboration with USGS at http://terraserver-usa.com/. There is a freely available web service with a WSDL. You can use common Java WSDL binding libraries like Axis or CXF to create java object to access the service.

Also, NASA has the World Wind project which has a Java API. The images are not the Google images but much of the Google images are based off of these images.


Recently Google launched the Maps Services for Java library, which brings support for the geocoding, directions, distance matrix, elevation and timezone APIs to Java.


embed a web browser control into your client, displaying a HTML page that uses the javascript API.

Everything else will break eventually, since at least Google and Microsoft tend to change the link format for their aerial images regularly to make it harder to scrape them and store them offline (because they do not have bought licenses from the content providers for offline storage of these images).

Other services (like Googles geolocation service) can easily used from Java, and "normal maps" work well as well, but aerials are tricky (at least they were when I tried it the last time), but of course doable if you are able to ship an update when the format changes...

edit: It might be different with the Google Maps for Enterprises service, but expect to pay a five-digit dollar amount for it...


To see the literal map in your desktop app's window, you can embed a browser control that is Java-based and is compatible with the Google Maps application.

See this question to find out how to embed a browser in your Java app:

Embedding web browser window in Java


You'll likely need to go with Microsoft Map Point Web Services. I don't know if Google offers something comparable w/out Javascript.


Have a look at http://www.javaworld.com/javaworld/jw-01-2006/jw-0116-google.html. They describe how to work with Google Maps from Java and they have a war file (untested).


You might want to take a look at the official Google Maps Data API, which I believe has a Java client. However I think this is just for retrieving/updating the "data" portion of Maps, so it would not give you access (which you probably aren't licensed to) for the actual photos.


Check out http://javamaps.blogspot.com .


Need Your Help

Throttling brute force login attacks in Django

python django security brute-force

Are there generally accepted tactics for protecting Django applications against this kind of attack?

What is the purpose of class methods?

python class-method

I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions.