I would like to use google maps in my GWT application. The thing is that the gwt-maps API only supports Google Maps API version 2, and the regular maps api is version 3. So basically what I want to do is to use the standart js maps library from my GWT code, but this doesn’t work:
public void onModuleLoad() {
buildMap();
}
private final native void buildMap()/*-{
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}-*/;
I suspect that the problem is that onModuleLoad is not equivalent to body.onload. What do you think?
Ok, I found a solution.
The first thing I did was to create a UIBinder to hold the div of the map:
And here is the rest of the code: