Home > Enterprise >  Merging google direction service and directionsrenderer results
Merging google direction service and directionsrenderer results

Time:03-24

Using the @react-google-maps/api package, I create a value between points with google direction service and display the result in direction renderer. Imagine I have a start, end and 3 waypoints. I show the result with direction renderer and I can edit the polyline data. When I edit the result with the direction renderer, I update the state again. My problem is that when I add a new waypoint value, the direction service calculates again and produces results. If it is a direction renderer, I show the final result. Waypoint value added super. The polyline data that I edited with the direction renderer disappeared. How can I intelligently combine the result from the direction service with the polyline data I edited with the direction renderer?

CodePudding user response:

I solved my problem. I learned that when Direction render editable is active, the point it edits is added as a waypoint value. The problem is solved when I take the waypoint value from the direction renderer and add the waypoint as stopover false. So, I calculate it from the direction service and show it from the direction renderer, I edit it. My existing representation does not disappear when I add a new waypoint.

  • Related