New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route on Map #778

Closed
mersay opened this Issue Nov 8, 2016 · 9 comments

Comments

Projects
None yet
9 participants
@mersay

mersay commented Nov 8, 2016

is there any plans to make routes between the two markers show on the map??

@symmetriccurve

This comment has been minimized.

symmetriccurve commented Nov 9, 2016

You can simply use any Set of polyline data to route between two markers just have markers on first and last coordinates of polyline data

@yellowbang

This comment has been minimized.

yellowbang commented Nov 22, 2016

screen shot 2016-11-21 at 7 20 55

This is what I have. When a street is not straight, it will has problem. Any suggestions?
@symmetriccurve

This comment has been minimized.

symmetriccurve commented Nov 22, 2016

Get the polyline data from google routes like services so that you have polyline running through the roads.

@yellowbang

This comment has been minimized.

yellowbang commented Nov 26, 2016

Yes, that is what i did. However the polyline data from google routes are the coordinates of the starting and ending point of a street. If a street is straight, the polyline fits it well, but when a street is curved (eg, the Market St in my last screenshot), polyline is not working well as expect.

by the way, this is the url I use for getting the route data:
'https://maps.googleapis.com/maps/api/directions/json?origin=' + startPosition + '&destination=' + endPosition + '&departure_time='+Date.now()+'&traffic_model=best_guess&key=' + Util.GOOGLE_API_KEY;

Thanks.

@mCzolko

This comment has been minimized.

mCzolko commented Nov 27, 2016

You should use the DirectionsService from Google API (If it is available on SDK on mobiles I know that on JS is). When you ask for routes via URL (as you did) you will get up to 50 major points coordinates. Could you imagine big will be the response JSON if you asked for directions from New York to SF? Too big. Please close this issue. The issue is not within this library but in your business logic.

Please read more here: https://developers.google.com/maps/documentation/javascript/directions

I'm not sure if there is a support for Map SDK (but is should be)

@ericapply

This comment has been minimized.

Contributor

ericapply commented Mar 24, 2017

@yellowbang You need to use overview_polyline.points data

"overview_polyline": {
        "points": "--------"
      }

You can decode it using https://github.com/mapbox/polyline or something similar

@bramus

This comment has been minimized.

Contributor

bramus commented Nov 19, 2017

Based upon the feedback here (and in #929) I've knocked up a standalone and immediately usable component to do just that: https://github.com/bramus/react-native-maps-directions

@flyandi

This comment has been minimized.

flyandi commented Aug 3, 2018

I just released a new library that encompasses all of this.. https://github.com/flyandi/react-native-maps-navigation

@rborn

This comment has been minimized.

Collaborator

rborn commented Oct 18, 2018

closing, very old

@rborn rborn closed this Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment