30 minutes with Servoy developer series

Frequently asked questions. Look here before posting questions. If you don't find an answer here you can post your question to the most appropriate forum.

Re: 30 minutes with Servoy developer series

Postby sean » Thu Mar 26, 2020 8:33 pm

* While we know it's definitely NOT business-as-usual, we here at Servoy are still at work (from home). And we feel it is important to bring you these updates wherever you are.

Part 3 - Friday March 27 - Google Maps Component Update

To wrap up this launch series, we’ll look at enhancements to one of our more popular components, SvyGMaps, which combines Servoy’s data-binding with Google Maps. This webinar is for anyone having geographic data in their applications, including addresses or geographic features. You will learn:

    How to delight your users by adding a geographic perspective to your application.
    What’s new since the last release
    Including gesturing, enhanced markers, route mapping and more.

Register Here

8am Los Angeles (PST)
11am New York (EST)
16h Amsterdam (CET)

If you missed Part 1 & 2 or want to re-watch it, you can stream it from our archives.
Software Engineer
Servoy USA
sean
 
Posts: 208
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: 30 minutes with Servoy developer series

Postby steve1376656734 » Fri Mar 27, 2020 6:01 pm

Hi Sean,

Thanks for a great demo today.

I asked a question regarding GeoCoding addresses and you said that this was not available through the component but was simple to achieve through the Google API. Could you share anything on this that would help me please?

Thanks
Steve
Steve
SAN Developer
There are 10 types of people in the world - those that understand binary and those that don't
steve1376656734
 
Posts: 232
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: 30 minutes with Servoy developer series

Postby sean » Fri Mar 27, 2020 6:16 pm

Hi Steve,

Thanks for watching and great question! The component is more for rendering a map. But one can use the sample Google Maps API Key to geocode via simple rest API.

Below is a snippet for a single address. For a full reference spec see Google's Docs

Code: Select all
function geocodeAddess(){
   
   //   GEO-CODE BASE URL
   var url = 'https://maps.googleapis.com/maps/api/geocode/json';
   
   // THE ADDRESS TO GEO-CODE
   var address = foundset.displayAddress;
   
   // APPEND ADDRESS AND API KEY PARAMETERS
   url += '?address=' + encodeURI(address);   // don't forget to URL-encode
   url += '&key=' + apiKey;
   
   // CREATE A SIMPLE GET RREQUEST
   var client = plugins.http.createNewHttpClient();
   try {
      var request = client.createGetRequest(url);
      var response = request.executeRequest();
      var status = response.getStatusCode();
      
      // PROCESS RESPONSE
      if(status == plugins.http.HTTP_STATUS.SC_OK){
         var body = response.getResponseBody();
         
         /** @type {{results:Array<{formatted_address:String,geometry:{location:{lat:Number,lng:Number}}}>}} */
         var geocoded = JSON.parse(body);
         
         application.output('Formatted Address: ' + geocoded.results[0].formatted_address);
         application.output('Lat / Long: ' + geocoded.results[0].geometry.location.lat + ',' +
            geocoded.results[0].geometry.location.lng);
         
         
      }

    // CLEAN_UP
   } finally{
      client.close();
   }
}
Software Engineer
Servoy USA
sean
 
Posts: 208
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Previous

Return to FAQ

Who is online

Users browsing this forum: No registered users and 0 guests

cron