Dammyololade / flutter_polyline_points

A flutter plugin that's decodes encoded google poly line string into list of geo-coordinates suitable for showing route/polyline on maps
MIT License
105 stars 130 forks source link

Given polylines for route is not "snapped" to roads #70

Closed Yahllil closed 1 year ago

Yahllil commented 2 years ago

I am using the flutter_polyline_points package to draw a route between multiple points on my GoogleMap widget (providing start point, end point, and multiple points in between).

The polylines are being drawn perfectly fine, and everything seems to work, except for the fact that the polylines are not "snapped" to the roads, and seem like just a line between each point. Please see this example:

Exmaple image

I am getting the points for the polyline like this:

PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
      kGooglePlacesAPIKey,
      PointLatLng(
        startPoint.latitude,
        startPoint.longitude,
      ),
      PointLatLng(
        endPoint.latitude,
        endPoint.longitude,
      ),
      wayPoints: myAddresses.map((currAddress) {
        return PolylineWayPoint(
          location: '${currAddress.latitude},${currAddress.longitude}',
        );
      }).toList(),
    );

Does anyone know why it is occurring? Is there a way to solve it using this package?

Thank you

Hectorc70 commented 2 years ago

Igual me sucede,al parecer solo sucede con distancias muy grandes

guiiamorim commented 1 year ago

@Yahllil did you find any solution for this? Can't seem to find any solution out there. I'm building my route the same way as you.

rodrigo-badaro commented 1 year ago

@guiiamorim I changed DIRECTIONS API for the ROUTES API.

the polylines provided by ROUTES API is more detailed and the lines follow the roads perfectly

image

guiiamorim commented 1 year ago

I see, will try this to see if it works, thanks!

Dammyololade commented 1 year ago

This has now been optimised with the new release version 2.0.0