Hey Guys i have converted the code to google map v3. Thanks for your support Cheers
Below is the converted code,
function initialize(a, lat, long, driveMode, fromTitle, toTitle, disp) {
map[a] = new
google.maps.Map(document.getElementById("map_canvas_" + a), {
mapTypeId:
google.maps.MapTypeId.ROADMAP
});
var directionsService = new
google.maps.DirectionsService();
var directionsDisplay = new
google.maps.DirectionsRenderer();
directionsDisplay.setMap(map[a]);
directionsDisplay.setPanel(document.getElementById("directions_" + a));
if(driveMode == 'DRIVING'){
dirTravelMode =
google.maps.DirectionsTravelMode.DRIVING;
}else if(driveMode == 'WALKING'){
dirTravelMode =
google.maps.DirectionsTravelMode.WALKING;
}else{
dirTravelMode =
google.maps.DirectionsTravelMode.DRIVING;
}
var request = {
origin: lat,
destination: long,
travelMode: dirTravelMode
};
directionsService.route(request,
function(response, status) {
if (status ==
google.maps.DirectionsStatus.OK) {
// lat, long cordinates to draw
polyline starts
var pointsArray =
response.routes[0].overview_path;
var pll = 0;
var polyParams = [];
var polyLatLngs = [];
// if overview_path is too
large then use this technigue in forloop
if (pointsArray.length > 85)
{
vCount =
pointsArray.length;
vCountLength =
Math.ceil(vCount / 75);
}
// technique ends
if(vCount > 0) {
for (pll = 0; pll <
pointsArray.length; pll+=vCountLength)
{
polyLatLngs.push(pointsArray[pll].lat ().toFixed(5) + "," +
pointsArray[pll].lng ().toFixed(5));
}
}else{
for (pll = 0; pll <
pointsArray.length; pll++)
{
polyLatLngs.push(pointsArray[pll].lat ().toFixed(5) + "," +
pointsArray[pll].lng ().toFixed(5));
}
}
polyParams.push(polyLatLngs.join("|"));
// lat, long cordinates to draw
polyline ends
// Draw static map starts
var defaultZoom = '13';
var baseUrl =
"http://maps.googleapis.com/maps/api/staticmap?";
baseUrl += "&markers=" +
encodeURIComponent("color:green|label:A|" + lat);
baseUrl += "&markers=" +
encodeURIComponent("color:green|label:B|"+ long);
baseUrl += "&size=500x500";
baseUrl +=
"&key=AIzaSyANpAUROdUr6hlIM5vNyiCYsoacowmoNdU";
baseUrl +=
"&zoom="+defaultZoom;
baseUrl += "&path=" +
polyParams;
baseUrl += "&sensor=false";
addImg(baseUrl,
"staticMapOverviewIMG_" + a, a);
// Draw static map ends
// Make Directions Part starts
var legsArray =
response.routes[0].legs[0];
makeDirections(legsArray, a,
fromTitle, toTitle, disp, defaultZoom);
// Make Directions Part ends
// google map and directions --
map_canvas (hidden)
//directionsDisplay.setDirections(response);
}else if(status ==
google.maps.DirectionsStatus.NOT_FOUND){
alert("No corresponding
geographic location could be found for one of the specified addresses. This
may be due to the fact that the address is relatively new, or it may be
incorrect.");
}else{
alert("An unknown error
occurred.");
}
});
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
