PDA

View Full Version : Anybody managed to use Google Maps v3 with GXT 2.x?



AndreV
3 Jul 2013, 8:38 AM
I've included gwt-maps.jar version 3.8.0, added theses entries to my gwt.xml file -

<inherits name="com.google.maps.gwt.GoogleMaps"/>
<script src="http://maps.google.com/maps/api/js?sensor=false" />

and this is a snippet of my test code -

MapOptions options = MapOptions.create();
options.setCenter(LatLng.create(39.509, -98.434));
options.setZoom(6);
options.setMapTypeId(MapTypeId.ROADMAP);
options.setDraggable(true);
options.setMapTypeControl(true);
options.setScaleControl(true);
options.setScrollwheel(true);

theMap = GoogleMap.create(container.getElement(), options) ;

Whilst this creates the map object ok I get a stack overflow further down the line. Increasing the stack size doesn't help.

Interestingly, the map works fine and I can interact with it as expected, but the other non-map panels fail to load.

Has anybody had any joy with this at all? Or even maps v2?

AndreV
4 Jul 2013, 3:50 AM
Got this working now.

I had created an html div container and had hooked the map creation code to the onAfterLayout function.

Although I was checking that the container had rendered it still didn't work. Eventually moving this code to onLoad solved it.