Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:36:49+00:00 2026-06-12T05:36:49+00:00

Hi all trying to find the code to pull the latest co-ordinates from a

  • 0

Hi all trying to find the code to pull the latest co-ordinates from a google fusion table and insert it into the code below as the origin. (var origin1)

GOOGLE Fusion table setup;

   {
     "kind": "fusiontables#columnList",
     "totalItems": 15,
     "items": [
      {
       "kind": "fusiontables#column",
       "columnId": 0,
       "name": "description",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 1,
       "name": "kind",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 2,
       "name": "name",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 3,
       "name": "placeId",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 4,
       "name": "info1",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 5,
       "name": "info2",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 6,
       "name": "info3",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 7,
       "name": "info4",
       "type": "STRING"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 8,
       "name": "accuracy",
       "type": "NUMBER"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 9,
       "name": "speed",
       "type": "NUMBER"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 10,
       "name": "heading",
       "type": "NUMBER"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 11,
       "name": "altitude",
       "type": "NUMBER"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 12,
       "name": "altitudeAccuracy",
       "type": "NUMBER"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 13,
       "name": "timestamp",
       "type": "NUMBER"
      },
      {
       "kind": "fusiontables#column",
       "columnId": 14,
       "name": "geometry",
       "type": "LOCATION"
      }
     ]
    }

and here is some of the data it keeps, i am trying to get the “LATEST” geometry coordinates and add that my map, to provide realtime updates.

{
 "kind": "fusiontables#sqlresponse",
 "columns": [
  "description",
  "kind",
  "name",
  "placeId",
  "info1",
  "info2",
  "info3",
  "info4",
  "accuracy",
  "speed",
  "heading",
  "altitude",
  "altitudeAccuracy",
  "timestamp",
  "geometry"
 ],
 "rows": [
  [
   "",
   "",
   "Location at Mon 14/05/2012 13:42:58",
   "",
   "resourceasstring",
   "",
   "",
   "",
   "65",
   NaN,
   NaN,
   NaN,
   NaN,
   1.336966978085E12,
   {
    "geometry": {
     "type": "Point",
     "coordinates": [
      144.9339931215855,
      -37.83169408321385,
      0.0
     ]
    }
   }
  ],
  [
   "",
   "",
   "Location at Mon 14/05/2012 19:20:11",
   "",
   "resourceasstring",
   "",
   "",
   "",
   "1414",
   NaN,
   NaN,
   NaN,
   NaN,
   1.336987211753E12,
   {
    "geometry": {
     "type": "Point",
     "coordinates": [
      145.2516605102396,
      -37.92732182161065,
      0.0
     ]
    }
   }
  ],
  [
   "",
   "",
   "Location at Mon 14/05/2012 19:40:12",
   "",
   "resourceasstring",
   "",
   "",
   "",
   "1414",
   NaN,
   NaN,
   NaN,
   NaN,
   1.336988412041E12,
   {
    "geometry": {
     "type": "Point",
     "coordinates": [
      145.3447657261889,
      -37.91152087158031,
      0.0
     ]
    }
   }
  ],
  [
   "",
   "",
   "Location at Tue 15/05/2012 09:41:57",
   "",
   "resourceasstring",
   "",
   "",
   "",
   "65",
   NaN,
   NaN,
   NaN,
   NaN,
   1.337038917553E12,
   {
    "geometry": {
     "type": "Point",
     "coordinates": [
      144.9339498133275,
      -37.8317148043096,
      0.0
     ]
    }
   }
  ],

This is the html/java code that display’s the map;

 <!DOCTYPE html>
    <html>
      <head>
        <title>Google Maps API v3 Example: Distance Matrix</title>
        <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>

        <style>
          body {
            margin: 20px;
            font-family: courier, sans-serif;
            font-size: 12px;
          }
          #map {
            height: 480px;
            width: 640px;
            border: solid thin #333;
            margin-top: 20px;
          }
        </style>

        <script>
        //Taken and adopted from https://developers.google.com/maps/documentation/javascript/distancematrix
        //Need to make the fusion table part work next!!
          var map;
          var geocoder;
          var bounds = new google.maps.LatLngBounds();
          var markersArray = [];

//var origin1 is where i want it to pull the data from the fusion table.
          var origin1 = new google.maps.LatLng(-37.83169408321385,144.9339931215855);
          var destinationA = 'glen iris, Australia';


          var destinationIcon = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=D|FF0000|000000';
          var originIcon = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=O|FFFF00|000000';

          function initialize() {
            var opts = {
              center: new google.maps.LatLng(-37.83,144.93),
              zoom: 20,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById('map'), opts);
            geocoder = new google.maps.Geocoder();
          }

          function calculateDistances() {
            var service = new google.maps.DistanceMatrixService();
            service.getDistanceMatrix(
              {
                origins: [origin1],
                destinations: [destinationA],
                travelMode: google.maps.TravelMode.DRIVING,
                unitSystem: google.maps.UnitSystem.METRIC,
                avoidHighways: false,
                avoidTolls: false
              }, callback);
          }

          function callback(response, status) {
            if (status != google.maps.DistanceMatrixStatus.OK) {
              alert('Error was: ' + status);
            } else {
              var origins = response.originAddresses;
              var destinations = response.destinationAddresses;
              var outputDiv = document.getElementById('outputDiv');
              outputDiv.innerHTML = '';
              deleteOverlays();

              for (var i = 0; i < origins.length; i++) {
                var results = response.rows[i].elements;
                addMarker(origins[i], false);
                for (var j = 0; j < results.length; j++) {
                  addMarker(destinations[j], true);
                  outputDiv.innerHTML += origins[i] + ' to ' + destinations[j]
                      + ': ' + results[j].distance.text + ' in '
                      + results[j].duration.text + '<br>';
                }
              }
            }
          }

          function addMarker(location, isDestination) {
            var icon;
            if (isDestination) {
              icon = destinationIcon;
            } else {
              icon = originIcon;
            }
            geocoder.geocode({'address': location}, function(results, status) {
              if (status == google.maps.GeocoderStatus.OK) {
                bounds.extend(results[0].geometry.location);
                map.fitBounds(bounds);
                var marker = new google.maps.Marker({
                  map: map,
                  position: results[0].geometry.location,
                  icon: icon
                });
                markersArray.push(marker);
              } else {
                alert('Geocode was not successful for the following reason: '
                  + status);
              }
            });
          }

          function deleteOverlays() {
            if (markersArray) {
              for (i in markersArray) {
                markersArray[i].setMap(null);
              }
              markersArray.length = 0;
            }
          }

        </script>
      </head>
      <META HTTP-EQUIV="refresh" CONTENT="60">
      <body onload="initialize(), calculateDistances()">
        <div id="inputs">
          <pre class="prettyprint">
    This will automatically calculate distances on load and then will re-load every minute. hahaha...
    Really need to work out how to pull data from a fusion table as well.
          </pre>
          <p><button type="button" onclick="calculateDistances();">Force Re-Calculate
            distances</button></p>
        </div>
            <div id="outputDiv"></div>
        <div id="map"></div>
      </body>
    </html>

thx
matt.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:36:51+00:00Added an answer on June 12, 2026 at 5:36 am

    Proof of concept:

    http://www.geocodezip.com/v3_GoogleEx_FusionTables_latestData.html

    Uses the FusionTables API v1.0 to query the table for the data; creates a native Google Maps API v3 marker for the “latest” location (the one with the greatest value in the timestamp column).

    Note that if you have lots of markers or only markers you may want to modify the approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm stumped on casbah find. I'm trying to pull back all documents from a
I'm trying to find a way to delay all code that takes place after
I've been searching all over trying to find simple code to add multiple markers
I have searched all over the internet trying to find example code in PHP
Hey all i am trying to find examples of getting data back from a
Hey all i am trying to find some code that would allow me to
I am trying to find a way to pull all notes that are assigned
I've search all over today trying to find how to do this, and not
I'm trying to find all element that contains all words in a phrase after
I'm trying to find all href links on a webpage and replace the link

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.