views:

33

answers:

1

Hi, I am using google map for showing driving directions between 2 places. The code is like this:

var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
$(document).ready(function(){
 directionsDisplay = new google.maps.DirectionsRenderer();
 var chicago = new google.maps.LatLng(34.044756,-118.546677);
 var myOptions = {
  zoom:14,
  mapTypeId: google.maps.MapTypeId.ROADMAP,
  center: chicago
 }
 map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
 directionsDisplay.setMap(map);
});

function calcRoute() {
 if(document.getElementById("end_point").value != ""){
  var directionsService = new google.maps.DirectionsService();
  var start = document.getElementById("start_point").value;
  var end = document.getElementById("end_point").value;
  var request = {
   origin:start, 
   destination:end,
   travelMode: google.maps.DirectionsTravelMode.DRIVING
  };
  directionsService.route(request, function(result, status) {
   if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setDirections(result);
   }
  });
 }
}

Now, as you see for default location it only takes latitude and longitude(points). I want to use address(like-910 Lincoln,Blvd,Santa Monica, CA) instead of lat-long. This is because the default location is dynamic. How can I do that?? any Idea???