Google Maps API Library for GWT


Hello everybody,

2009 starts with a very good news for Java web developers interested in Google Maps services. This week, the Google Geo Developers Blog published about the announcement of  the Google API Libraries for Google Web Toolkit. They’re a collection of libraries that provide Java language bindings for popular Google JavaScript APIs, facilitating its use with GWT, which translates your Java code into JavaScript for deployment to end users.

In short, this library provides a way to access the Google Maps API from a GWT project without having to write additional JavaScript code. Here is how it happens:

public class SimpleMaps implements EntryPoint {
  private MapWidget map;

  // GWT module entry point method.
  public void onModuleLoad() {
    LatLng cawkerCity = LatLng.newInstance(39.509,-98.434);
    // Open a map centered on Cawker City, KS USA

    map = new MapWidget(cawkerCity, 2);
    map.setSize("500px", "300px");

    // Add some controls for the zoom level
    map.addControl(new LargeMapControl());

    // Add a marker
    map.addOverlay(new Marker(cawkerCity));

    // Add an info window to highlight a point of interest
        new InfoWindowContent("World's Largest Ball of Sisal Twine"));

    // Add the map to the HTML host page

For more informations, the library comes with online examples and a straitforward tutorial.

See you.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s