User's Location as Point of Origin
Often you may want to get directions starting from a user's actual current position, instead of from another fixed Location. The following code snippet gives an example on how to implement this.
To query for a route, create a MPPoint
from the Latitude, longitude and the z-index of the user, and use that on the DirectionsService.query
function, like this:
userLatitude
, userLongitude
. userZIndex
and destinationLocation
are all placeholder variable names where you insert your data.
Further details on how user positioning works, and how to display it, can be found here.
This results in directions queries originating from the user's current location.a
Last updated