Forum Xamarin.Forms

Xamarin Forms Map Direction

DeepakDeepsDeepakDeeps INMember ✭✭✭

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?

Best Answer


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    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.

  • DeepakDeepsDeepakDeeps INMember ✭✭✭

    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.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    You need to check with the provider of your maps/routes. There are several.

    For example:

    Google for example:


    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?

  • DeepakDeepsDeepakDeeps INMember ✭✭✭

    @ClintStLaurent Thanks for your suggestion. i will keep you posted.

  • DeepakDeepsDeepakDeeps INMember ✭✭✭


    I tried with, i ran through the sample application. The routes are not drawn between point A to B and point A to C.

  • DeepakDeepsDeepakDeeps INMember ✭✭✭

    can you able to find the solution for this?

  • DeepakDeepsDeepakDeeps INMember ✭✭✭


    This also drawing straight lines only, but i am expecting need to draw on road instead of straight lines.

  • XnainaXnaina USMember ✭✭✭

    I think this issue in collection of lat and lng not in polylines.
    Can you share your collection of lat and lng?

  • DeepakDeepsDeepakDeeps INMember ✭✭✭

    Thanks for the response, These are the lat,lng i have used

    40.77d, -73.93d
    40.81d, -73.91d
    40.83d, -73.87d
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    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.

  • DeepakDeepsDeepakDeeps INMember ✭✭✭
    Accepted Answer

    @ClintStLaurent , @BalaRaju , @Xnaina Thanks for your support. I resolved my issue,i forgot to enter apikey for Direction.

  • SuperballSuperball USMember

    Hi sir.
    You can send the code to make it for me. As a guide for education.
    Because I have tried run samples from https: / / / TorbenK / TK.CustomMap and it fail.

  • AbhiVazeAbhiVaze Member ✭✭

    @DeepakDeeps so were you able to draw "Route" between two points/places using Direction API on Xamarin.Forms ?

  • DeepakDeepsDeepakDeeps INMember ✭✭✭



  • Could U give the screenshot of result U have, please?

  • AnithaAnitha Member ✭✭
    @ClintStLaurent Could you please give some suggestions how to show driving directions in Xamarin.Forms. i posted a question in forum.

    I am developing an application with xamarin forms. In that i have to show in app map with driving directions and instructions. I searched in google but i did not get any such kind of applications. All are done in native applications. Somehow i should achieve this feature in Forms.
  • yousufctecyousufctec USMember ✭✭✭

    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.


  • AnithaAnitha Member ✭✭
    Implementing it in my own app
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    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.

Sign In or Register to comment.