Google Maps + SmartGWT: Have you did it ?

Hi,

Reading the posts I didn’t find a solution for the integration of Google Maps.

Code like:
e

public class Gis extends HTMLPane
{
	final MapWidget mapWidget;
	
	public Gis()
	{
		setWidth100();
		setHeight100();

		mapWidget = new MapWidget();

		mapWidget.setDoubleClickZoom( true );
		mapWidget.setScrollWheelZoomEnabled( true );
		mapWidget.setZoomLevel( 3 );

		Canvas maps = new Canvas();
		maps.setWidth100();
		maps.setHeight100();
		maps.addChild( mapWidget );
		
		addChild( maps );
}
}

shows the map for a micro-second and then just disappears.

Have you successfully implemented Google Maps?

Thanks in advance,

See this post. Try searching the forums - there are a few threads on this that might help.

Sanjiv

Yes, that was the very first thread I found. But it doesn’t work for me (when you add it to an existing Canvas in the application). I’ve the same problem as the last poster:

"However, when browser resize, I see the following :

  • map redraws fine, shows for a sec or so
  • map container is cleared."

But I don’t even need to resize it. It just appears for a brief moment and then the container is cleared.

I’ll continue digging…

More information:

  • The reason I can’t see the map is because I hide its canvas calling .hide(), waiting for the user to activate it. If I create a canvas and I keep it without hiding the map is shown. When I resize the browser, it also disappears.

Does this ring any bell ?

I believe when resizing a google map you need to manually re-size the map itself. You might need to register a resize listener on the google map itself. There is some discussion on this in the gwt / gwt google API forums.