osm_flutter icon indicating copy to clipboard operation
osm_flutter copied to clipboard

How to Update the route on Users location change

Open ShabbirSaifuddin opened this issue 3 years ago • 4 comments

Hi,

Is there any method or anyway by which we can update the route depending on the location of the user?

I am using the below code to set a route from the user's current location to a specific cordinates, but when the user changes location the route doesn't update. Is there any way I can update the route when the user changes location.

The Code

await controller.enableTracking();
GeoPoint geoPoint = await controller.myLocation();

print (geoPoint.latitude);
print(geoPoint.longitude);

RoadInfo roadInfo = await controller.drawRoad(
GeoPoint(latitude: geoPoint.latitude, longitude: geoPoint.longitude),
GeoPoint(latitude: 24.913608364530518, longitude: 67.03123161285491),
interestPoints : [GeoPoint(latitude: 24.913608364530518, longitude: 67.03123161285491)],
   roadOption: RoadOption(
   roadWidth: 20.0,
   roadColor: Colors.red,
showMarkerOfPOI: true
 ),
);
   print("${roadInfo.distance}km");
   print("${roadInfo.duration}sec");


I've also tried using

await controller.enableTracking().then((value) => {
    GeoPoint geoPoint = await controller.myLocation();
      ...
    });

But it doesn't work.

Can someone help me out on this issue?

ShabbirSaifuddin avatar Jun 28 '21 07:06 ShabbirSaifuddin

turn by turn navigation not implement yet it need specific implementation (infrastruction + code )
drawRoad in the map is just static and we using open source routing server you can change it manually every 1 min for example and adjust camera

liodali avatar Jun 28 '21 11:06 liodali

Just out of curiosity, Do you plan to implement turn-by-turn navigation in the future, or it's not the scope of this project?

jesussmile avatar Jul 02 '21 15:07 jesussmile

I already think about a lot but for next 3 months i will focus on ios and web support but when i will find greate solution for it of course i will added but it will be as external library

liodali avatar Jul 02 '21 15:07 liodali

Just out of curiosity, Do you plan to implement turn-by-turn navigation in the future, or it's not the scope of this project?

Even I am looking out for navigation support using OSM

KeshavPai avatar Dec 23 '22 06:12 KeshavPai