How to run google maps on smart client

Hi,
i was having problems with google maps. I am trying to show a google map on a bean named ServoyBrowser. A bean loaded with patrick talbot BrowserSuite plugin. I can show the entire page of google maps but i just want to show the map only. I want to load it with an adress that i pass it. And i have to run it on smart client.
My questions are… How can i load just the map without the entire page? and then how i load it with an adress?

thanks in advance

you need to do this via the google maps api
http://code.google.com/intl/nl/apis/maps/

On this page you’ll find a section: ‘How do I start’

mboegem thanks for sharing the link this is very useful on my next project

Hello all,

Its two year after the original post…:)

Did you get anyway to pass a value from servoy (lets say address in the above case) to show it in the google map??

I want to pass a servoy variable to the Javascript file, for web-Client i am using the “webClientUtiles” Plugin but that plugin wont work in rich client.

Is there any alternative of webClientUtiles for rich client of to do this??

Thanks in advance for your reply.

Sovan

I just setup the html in the onRecordSelection, something like below.
This html is being set right away into the html area of the browserbean (ServoyForge browsersuite)

$mapHtml += '<html><head>';
		$mapHtml += '<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=' + _myAPIkey+ '"></script>';
		$mapHtml += '<script type="text/javascript">';
		$mapHtml += 'function initialize()';
		$mapHtml += '{';
		$mapHtml += '	if (GBrowserIsCompatible())';
		$mapHtml += '	{';
		$mapHtml += '		var map = new GMap2(document.getElementById("map_canvas"));';
		$mapHtml += '		var latlng = new GLatLng(' + _myGeoLocation + ');';
		$mapHtml += '		var marker = new GMarker(latlng);';
		$mapHtml += '		map.setCenter(latlng, ' + _myZoomLevel + ');';
		$mapHtml += '		map.addOverlay(marker);';
		if($accuracy < 5)
		{
			$mapHtml += '		map.openInfoWindow(latlng, "' + _myAddress + '");';
		}
		else
		{
			$mapHtml += '		GEvent.addListener(marker,"click", function()';
			$mapHtml += '		{';
			$mapHtml += '			var myHtml = "' + _myAddress+ '";';
			$mapHtml += '			map.openInfoWindowHtml(latlng, myHtml);';
			$mapHtml += '		});';
		}
		$mapHtml += ' 	}';
		$mapHtml += '}';
		$mapHtml += '</script></head>';
		$mapHtml += '<body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">';
		$mapHtml += '	<div id="map_canvas" style="width: 100%; height: 100%"></div>';
		$mapHtml += '</body></html>';

Hope this helps!

Hi Marc,

Thanks a lot…

Sovan