Mapbox integration#145
Open
NicholasS13 wants to merge 6 commits into
Open
Conversation
duskcloudxu
reviewed
Jul 30, 2020
| link | ||
| ) | ||
| .then(response => { | ||
| setDistance(response.data.routes[0].distance/1609); |
Author
There was a problem hiding this comment.
That is to convert the value given from meters to miles
| @@ -0,0 +1,13 @@ | |||
| import axios from "axios"; | |||
Collaborator
There was a problem hiding this comment.
I think it should be more of a utility function and should be put under src/state/actions?
Author
There was a problem hiding this comment.
Ok-will change that and check lint
…rsion of expo does not work with this project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
[Trello Card]
https://trello.com/c/nujUoXWA/235-method-for-distance-calculation
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
added getDriveDistance function using mapbox
What is the current behavior? (You can also link to an open issue here)
N/A
What is the new behavior? (if this is a feature change)
N/A -needs to be added to map and list for client
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
no
Other information
Usage :
//need to import function
import getDriveDist from ".src/state/actions/mapbox";
//need to create these variables for each usage case(setDistance2,distance2...) in order for this to work
const [distance, setDistance] = React.useState("undefined");
//this is the actual function that does the calculation, you need to pass in the setDistance value created above
//longitude1/latitude1 represent user location and longitude2/latitude2 represents location that they would travel to
getDriveDist = (latitude1:, longitude1, latitude2,longitude2,setDistance)
//then to display drive distance print {distance}
{distance}
Discussion Questions
If you need help integrating this- DM me
Images (before/ after screenshots, interaction GIFs, ...)
N/A
TODO
none