Regarding Turn by turn navigation implementation. #136
Replies: 5 comments 6 replies
-
yeah, it's good start to add turn by turn navigation |
Beta Was this translation helpful? Give feedback.
-
Hi, @jesussmile! Can you provide an example app with your implementation of turn-by-turn navigation, please? 🙂 |
Beta Was this translation helpful? Give feedback.
-
Can you share the github repo link for the same if you don't mind. I have to just do a small demo regarding this navigation using OSM. I am totally new to Flutter and OSM as well. I just have to create a small demo of the navigation part and then the rest of the complete implementation will be taken over by the Development Team |
Beta Was this translation helpful? Give feedback.
-
My project is all tied to firebase , it will be difficult for me to create just that and not sure if you will understand. The basic idea is to get the list of names in the road then compare one point to the another, import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
double _latitude1 = 37.4219999;
double _longitude1 = -122.0840575;
double _latitude2 = 37.7749295;
double _longitude2 = -122.4194155;
void _launchMap() async {
String googleUrl = 'https://www.google.com/maps/dir/?api=1&origin=$_latitude1,$_longitude1&destination=$_latitude2,$_longitude2';
if (await canLaunch(googleUrl)) {
await launch(googleUrl);
} else {
throw 'Could not open the map.';
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Google Map Navigation'),
),
body: Center(
child: RaisedButton(
onPressed: _launchMap,
child: Text('Launch Map'),
),
),
);
}
} I am sure the author of this plugin will add this feature in future. For now. You can use osm map for everything else theb send navigation to Google maps. |
Beta Was this translation helpful? Give feedback.
-
I want to share this package : https://github.com/liodali/OSM-Routing-Client-Dart where is for OSRM APIs |
Beta Was this translation helpful? Give feedback.
-
Here's what I have done. Downloaded all the JSON data that contains the API then using some algorithm calculated the latitude and longitude values for all the turns and directions and compared them with my current position, I kept a certain value like 50 or 100 meters to warn the users about changes in direction. I streamed my position to always be in the center of the map with heading and speed. With heading, I can change the orientation of the map to show the road straight ahead. I get a very rough turn-by-turn implementation. Do you think this approach is okay? In the future, I would like to see how you have implemented the polylines and try to compute the directions offline.
It's funny how the arrow is dragging my car! 😄
My.Video.mp4
Beta Was this translation helpful? Give feedback.
All reactions