More maps feature

Any plans of adding more map functionality? I need to track more advanced routing, and distance tracking. I am working on a app for order tracking to track orders being picked up from a warehouse and being delivered to clients. I need to know the distance between each warehouse, client and even the distance to the next client on the list.

I can’t even find a way to do this with Integromat or Zapier. Can I do this with API? This is a must have for this one client.

If I can vote on a feature this would be number 1 for me. :pray:

@Lawrence - presently this is not possible directly within Tadabase. However, its easily possible using a simple webhook and a script.

Our support team recently assisted another Tadabaser with something similar. I will track down the code/process and post it here as soon as I can.

If you need this more urgently please contact us and we’d be delighted to assist.

As promised, here’s how a customer accomplished calculating distances in Tadabase.

Here’s an example of how this works:

We have received permission from this user to post his code here.

Paste the code below into your Script and send a webhook to the script address.

Be sure to update the field ID’s and API credentials.

function doPost(e) {
  //Here we are assuming field_68 is the first address field and field_69 is the second address field. 
  var START_ADDRESS = e.parameter['field_68[address]'] + ' ';
  START_ADDRESS += e.parameter['field_68[city]']  + ' ';
  START_ADDRESS += e.parameter['field_68[state]']  + ' ';
  START_ADDRESS += e.parameter['field_68[zip]'];
  var END_ADDRESS = e.parameter['field_69[address]'] + ' ';
  END_ADDRESS += e.parameter['field_69[city]']  + ' ';
  END_ADDRESS += e.parameter['field_69[state]']  + ' ';
  END_ADDRESS += e.parameter['field_69[zip]'];
  //We need to get the record id so we can then update the record with the distance
  var RECORD_ID = e.parameter['id'];
  //Now we run the function to calculate the distance and directions. 
  //Once the Distance function has run, we can run the custom function to update the record with these details 
  updateRecord(RECORD_ID, DISTANCE);

function updateRecord(RECORD_ID, DISTANCE) {
  var Request_Var = {
        'method' : 'POST',
        'headers': {
           "X-Tadabase-App-id" : "PUT-YOUR-APP-ID-HERE",
           "X-Tadabase-App-Key" : "PUT-YOUR-API-KEY-HERE",
           "X-Tadabase-App-Secret" : "PUT-YOUR-APP-KEY-HERE"
  //Let's save these values back into Tadabase. Make sure to udpate the fields ID's. 
  var data = {
        'field_70' : DISTANCE.text,
        'field_72' : DISTANCE.instructions,
        'field_73' : DISTANCE.value
  var request = Request_Var;
  request.payload = data;
  var response = UrlFetchApp.fetch(""+RECORD_ID, request);

function GetDistance(start_address, end_address){
  var directions = Maps.newDirectionFinder()
  var distanceText = directions.routes[0].legs[0].distance.text;
  var distanceValue = directions.routes[0].legs[0].distance.value;
  //Optionally we can save the directions as well. Feel free to remove this part.
  var instructions = '<ul>';
  for (var i = 0; i < directions.routes[0].legs[0].steps.length; i++) {
    var step = directions.routes[0].legs[0].steps[i];
    instructions += "<li>" + step.html_instructions;
    instructions += " (" + (step.distance.value/5280).toFixed(2) + " miles)";
    instructions += "</li>";
  instructions += "</ul>";
  //Now we return the distance and instructions so we can save it back into Tadabase
  return {
    'text' : distanceText,
    'value' : distanceValue,
    'instructions' : instructions

As someone who is a complete JS novice, can you elaborate on this process?

Is this using Google scripts - like the script editor within Google Sheets?

Also, is it possible to use Google Maps conditions? Like “Avoid Tolls”

Hi Tim,

This is technically something that can be done with any coding language. We are fans of Google Scripts since its very powerful and is very easy to get started and easy to integrate with Maps, Gmail etc… Additionally, there’s no need to pay or spin up servers. This is indeed the same as Google Scripts inside of Google Sheets, but Google scripts can also be used as a standalone script.

You can utilize any classes or methods in the Google Maps scripts inside of this script.

For example, to avoid highways you would simple add the setAvoid method.

From the script above:

  var directions = Maps.newDirectionFinder()

Add: “.setAvoid(tolls)

    var directions = Maps.newDirectionFinder()

I hope this helps, let me know if there’s something specific you’re looking to do and I’d be happy to assist further.

Is the script suggested here the way to go prior to having the ‘Get Directions’ Pipe? Currently I have the Pipe with Google Directions API working for the most part, but I did catch this thread.

One function I haven’t quite figured out with the Pipe is how to get the Estimated Time of Arrival in the Payload response.

Side note: Google Directions API calls are roughly (based on my tests) $.01 for every 3 API calls - could get pricey quickly.