Geeks With Blogs


Add to Google

Tim Hibbard CEO for EnGraph software

Kyle asked for it, so now on Where's Tim, you can get directions, and distance from anywhere to my current location. Push the "Get Directions to Tim" button, a dialog box will instruct you to select a location on the map, you click on the map where you currently are (you can still drag and zoom the map), and using AJAX, it will generate a Google map with driving directions and mileage from where you selected to my current location.

Like I was talking about before, we want Where's Tim to resemble a business AVL application. This helps get us a step closer to that goal.

Here is the VB.NET code:

Public Function GetDirectionsURL(ByVal lat As String, ByVal lon As String) As String
'class that handles my current gps location
Dim myLoc As MyLocation.Loc = GPS.GetLocation
'generate url

Dim RV As String

        RV = "" & lat.ToString & ",+" & lon.ToString
        RV += "+to%3A"
        RV += "+" & & ",+" & myLoc.lon

Return RV
Catch ex As Exception
Return ""

End Function

The Javascript code:

var lstner;

function getdirections()
   alert("Click on your location on the map");
   lstner = GEvent.addListener(map, 'click', function(overlay, point){
      document.getElementById("btnGetDirections").value = "Working...";
      document.getElementById("btnGetDirections").disabled = true;
      var x = point.x;
      var y = point.y;
      wherestim.GetDirectionsURL(y,x, getdirections_callback);

function getdirections_callback(response)
   var av = response.value;
   document.getElementById("btnGetDirections").value = "Get Directions to Tim";
   document.getElementById("btnGetDirections").disabled = false;
   //window.navigate(av); wasn't working on firefox

Technorati Tag's: , , , , ,

Posted on Friday, November 11, 2005 7:40 AM EnGraph , .NET , GPS , Mapping , Where's Tim | Back to top

Comments on this post: Get Directions to Tim

# re: Get Directions to Tim
Requesting Gravatar...
Sweet! How about by an address location also instead of clicking? Perhaps an option?
Left by Kyle Archer on Nov 11, 2005 10:56 AM

Your comment:
 (will show your gravatar)

Copyright © Tim Hibbard | Powered by: