Xamarin forms maps Direction draws only straight lines, but i need to draw on road instead of straight lines
Please tell me how to resolve this?
@ClintStLaurent , @BalaRaju , @Xnaina Thanks for your support. I resolved my issue,i forgot to enter apikey for Direction.
That's the difference between Direction and Route. A direction is a straight line: "North" for example.
What you're describing is a Route. Is the route someone will drive to get from A to B.
A route is composed of lots of Maneuvers. Each Maneuver as a start and end that makes a small segment. When you plot all those tiny segments, you show the entire route.
But... most map providers will do all that for you when you use their routing API. So it sounds like you're not taking advantage of features they offer.
Thanks for the response @ClintStLaurent .
Yea, I Am looking for routes from Point A to point B. But all i get are straight lines with no pattern to the streets.
If there are Routing API's available that can solve my issue... could you suggest me?
Here is the reference link i used.https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/map/polyline-map-overlay/
You need to check with the provider of your maps/routes. There are several.
Google for example:https://developers.google.com/maps/documentation/directions/intro
You need to figure out who you want to use. Often that comes down to cost. One provider is cheap on the front end, but gets expensive on a per-call basis. Another might have a high rate, but its a flat-rate, so if you have 10,000 users it comes out cheap on a per-call basis. Make sense?
@ClintStLaurent Thanks for your suggestion. i will keep you posted.
Try below link
I tried with https://github.com/TorbenK/TK.CustomMap, i ran through the sample application. The routes are not drawn between point A to B and point A to C.
can you able to find the solution for this?
This also drawing straight lines only, but i am expecting need to draw on road instead of straight lines.
I think this issue in collection of lat and lng not in polylines.
Can you share your collection of lat and lng?
Thanks for the response, These are the lat,lng i have used
Looks like you are still just drawing lines from point to point to point.
Are you getting a Route between those three points?
You should be getting a route from your driving route API provider. A route for those 3 GPS points would probably have 20+ maneuvers and large collection of polyline points. For example, just going around a curve is 10 or more short polylines.
You can send the code to make it for me. As a guide for education.
Because I have tried run samples from https: / /github.com / TorbenK / TK.CustomMap and it fail.
@DeepakDeeps so were you able to draw "Route" between two points/places using Direction API on Xamarin.Forms ?
Could U give the screenshot of result U have, please?
Are you implementing it on your own map layout in your app or you just wanted to navigate user to a destination? If it is to navigate a person to a location, then you can use this Xamarin Essentials Function to implement it easily.
Turn-by-turn directions on a map inside your own app is against the free usage provision for Google mapping. I think Bing maps has the same limit. It makes sense: They can't provide that kind of service for free across millions of installations without getting something back to pay for it. They get that when you use their apps. But if its in your app they don't.
So you'll need to pay a directions provider for their service. Once you pick a directions provider (Such as HERE) they have samples and code, and controls you can drop into your app. For example: HERE provides you with an API and now they even have a Xamarin compatible MapControl you just place on your page. I had to build mine from scratch 3 years ago.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies