How to run google maps on smart client

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

How to run google maps on smart client

Postby nromeou » Wed May 05, 2010 11:10 pm

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
nromeou
 
Posts: 215
Joined: Fri Sep 18, 2009 8:38 pm
Location: Montevideo, Uruguay

Re: How to run google maps on smart client

Postby mboegem » Thu May 06, 2010 8:58 am

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'
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: How to run google maps on smart client

Postby jasonflord25 » Thu Jul 29, 2010 4:05 pm

mboegem thanks for sharing the link this is very useful on my next project
jasonflord25
 
Posts: 1
Joined: Thu Jul 29, 2010 2:29 pm
Location: California

Re: How to run google maps on smart client

Postby sovanm » Fri Feb 03, 2012 11:58 am

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
sovanm
 
Posts: 99
Joined: Fri Oct 28, 2011 1:55 pm
Location: Bhubaneswar, India

Re: How to run google maps on smart client

Postby mboegem » Sat Feb 04, 2012 12:19 am

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)

Code: Select all
$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!
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: How to run google maps on smart client

Postby sovanm » Thu Feb 09, 2012 2:14 pm

Hi Marc,


Thanks a lot...

Sovan
sovanm
 
Posts: 99
Joined: Fri Oct 28, 2011 1:55 pm
Location: Bhubaneswar, India


Return to How To

Who is online

Users browsing this forum: No registered users and 6 guests