Monday 15 March 2010

javascript - Accuracy of directions using Long/Lat with Google Maps API -


I am using Google Maps API v3 to show my property from the user-defined starting point to the direction.

It is technically working fine except for the accuracy of the end point. I have defined the long / light of my property at the exact point, but instructions still take you 100 meters away on the road.

Is there any way to apply the instructions to move in the right direction

function getdirections (x, y) {$ ("# directions panel"). Html ("");

Var Directions Service = New google.maps.DirectionsService (); Var Directions = New google.maps.DirectionsRenderer (); Var myOptions = {Zoom: 10, Map Type IID: google.maps.MapTypeId.ROADMAP, scrollwheel: false} var map = new google.maps.Map (document.getElementById ("map"), myOptions); DirectionsDisplay.setPanel (document.getElementById ('directionsPanel')); DirectionsDisplay.setMap (map); Var request = {origin: x, destination: $ ('.lat'). Text () + ',' + $ ('. Lng'). Text (), Trafficking Mode: google.maps.DirectationsTravelMode.DRIVING, Unit System: Google.maps.UnitSystem.IMPERIAL, Provide Advanced Options: True, Area: "GB"}; DirectionsService.route (requests, functions (response, status) display the directions. Set Direction (response); $ (". NoValidRoute"). Hide ();}); }

Assume that x, y in GetDirections (x, y) are the coordinates of your property that you are using only x .

TRY;

  function getdirections x, y) {var original = new google.maps.LatLng (x, y) $ ("# directional section"). Html (""); Var Directions service = new google.maps.DirectionsService (); Var Directions = New google.maps.DirectionsRenderer (); Var myOptions = {Zoom: 10, Map Type IID: google.maps.MapTypeId.ROADMAP, scrollwheel: false} var map = new google.maps.Map (document.getElementById ("map"), myOptions); DirectionsDisplay.setPanel (document.getElementById ('directionsPanel')); DirectionsDisplay.setMap (map); Var Request = {Origin: Origin, Destination: $ ('. Alphabet'). Text () + ',' + $ ('.lng'). Text (), traffic mode: google.maps. Directing travelmode.DRIVING, entity system: Google.maps.UnitSystem.IMPERIAL, provide advanced options: true, region: "GB"}; DirectionsService.route (requests, functions (response, status) display the directions. Set Direction (response); $ (". NoValidRoute"). Hide ();}); }    

No comments:

Post a Comment