Navigate Route
In this guide, you will learn how to compute a route between a departure point and a destination point, render the route on an interactive map, and then navigate along the route with real GPS positioning.
How it works
This example demonstrates the following features:
- Compute routes between current location and destination
- Display routes on a map with alternative route options
- Begin turn-by-turn navigation with real-time positioning
- Show navigation instructions and remaining distance/time
- Handle route recalculation when off-route
Live Demo
Try the interactive demo below. Click "Build Route" and then "Start Navigation" to begin turn-by-turn guidance:
Code Implementation
Building the Route
Calculate route from current location to destination:
Starting Navigation
Begin turn-by-turn navigation along the calculated route:
Handling Navigation Updates
Process navigation instructions and update the UI:
Key Features
- Real GPS Navigation: Uses actual device location for navigation
- Turn-by-Turn Instructions: Clear visual and text guidance
- Live Updates: Distance, duration, and ETA update in real-time
- Follow Mode: Map automatically follows current position
- Maneuver Icons: Visual indicators for upcoming turns
- Route Recalculation: Automatic rerouting when deviating from path
Next Steps
- Try the Simulate Navigation example to test without GPS
- Explore Lane Instructions for advanced lane guidance
- Check out Speed Watcher for speed limit monitoring