Hi, you can use: http://code.google.com/intl/pl/apis/maps/documentation/reference.html#GDirections.getDistance
getDistance() returns an Object that contains the distance information .getDistance().html is a HTML string that describes the distance in suitable units .getDistance().meters is a number indicating the distance in metres so: var distance = gdir.getDistance().meters; On 25 Sty, 11:44, rahul <[email protected]> wrote: > Hello Friend > > How can I extract only the distance from the given code? > > regards > Rahul R > > On Jan 25, 3:05 pm, rahul <[email protected]> wrote: > > > Thank you, thank you very much. > > > regards > > Rahul R > > > On Jan 25, 1:43 pm, Hari <[email protected]> wrote: > > > > Hi, > > > > Its quite simple: > > > > Just add two textboxes to your page where the user will input the from > > > and To location. Then on button click, call this method > > > > function ShowPath() > > > { > > > var gdir ; > > > var fromAddress = document.getElementById > > > ("TextboxFrom").value; > > > var toAddress = document.getElementById("TextboxTo").value; > > > > var map = new GMap2(document.getElementById("map_canvas")); > > > var geocoder = new GClientGeocoder(); > > > > if (geocoder) > > > { > > > geocoder.getLatLng(fromAddress,function(point) { > > > > if (! > > > point) > > > { > > > alert > > > (fromAddress + " not found"); > > > } > > > else > > > { > > > > map.setCenter(point, 15); > > > var > > > marker = new GMarker(point); > > > > map.addOverlay(marker); > > > // > > > marker.openInfoWindowHtml(fromAddress); > > > } > > > } > > > ); > > > } > > > > if (geocoder) > > > { > > > geocoder.getLatLng(toAddress,function(point) { > > > > if (! > > > point) > > > { > > > alert > > > (toAddress + " not found"); > > > } > > > else > > > { > > > > map.setCenter(point, 15); > > > var > > > marker = new GMarker(point); > > > > map.addOverlay(marker); > > > // > > > marker.openInfoWindowHtml(toAddress); > > > } > > > } > > > ); > > > } > > > gdir = new GDirections(map, document.getElementById > > > ("directions")); > > > gdir.load("from: " + fromAddress + " to: " + toAddress); > > > > } > > > > Hope this helps... > > > > On Jan 25, 11:09 am, rahul <[email protected]> wrote: > > > > > Hello All > > > > > I need to develop one like this:http://maps.google.co.in/maps? > > > > hl=en&tab=wl. Can any one help me in getting the source for the above. > > > > > regards > > > > Rahul R -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
