when ou are working with a google map directions, how do you uget the map to stay at the route you drag i to?
In Google Maps directions, the route usually won’t “stay locked” just because you drag it once. To keep the path, you need to save the dragged route as waypoints and reload it from those waypoints later, because dragging creates an editable route rather than a fixed one.
What to do
- Turn on draggable directions in the map setup.
- Listen for the route-changed event after the user drags the line.
- Read the route’s waypoints and store them in your app or database.
- When you redraw the map, rebuild the directions using those saved waypoints so the same route appears again.
Why it happens
Dragging a Google Maps route does not permanently change the original start- to-end directions by itself; it creates intermediate points that must be saved if you want the same route again later. If you do not store those points, Google Maps may recalculate the route back to a different path.
Simple example
If a user drags a route from A to B through C, your app should remember A → C → B, not just A → B. Then when the page reloads, you recreate the directions using A, C, and B so the route looks the same.
Practical tip
If you mean the regular Google Maps app, not the API, the closest workaround is adding extra stops or waypoints to influence the route, because the app prefers to recalculate automatically.
TL;DR: you do not “freeze” a dragged Google Maps route directly; you save the dragged route’s waypoints and redraw from them later.