Ionic native google maps : how to connect 2 marker on map and count the distance

how to connect 2 marker on map and count the distance between 2 marker?

thanks

picture 1

picture 2

On my application (picture 1), i use computeDistanceBetween() to count the distance between location A and location B, and i use addPolyline to draw the line between 2 locations.

Can i get distance between location A and location B like Google Maps Application (picture 2)?
because when using computeDistanceBetween() the return value not same like distance on Google Maps Applications?

And can i draw line between 2 locations like on Google Maps Application (fastest route)? not only draw a straight line between 2 locations like picture 1.

computeDistanceBetween() calculates the distance (in meters) two linear points.

In order to get the routes of two points, you need to implement Google Maps Directions API by yourself.

1 Like