refactor: correct order of the latitude and longitude in (*OsrmApiResponse).ToProto() method#2
Open
mgiks wants to merge 1 commit into
Open
refactor: correct order of the latitude and longitude in (*OsrmApiResponse).ToProto() method#2mgiks wants to merge 1 commit into
mgiks wants to merge 1 commit into
Conversation
api OSRM API's routing service returns coordinates in the order of longitude first and latitude second. For some reason the OSRM's docs don't explicitly specify that, but you can check that by sending a request to their api endpoint. Currently the trip service's (*OsrmApiResponse).ToProto() method parses the data in incorrect order, thus making latitude value be longitude and vice versa. Additionally, react-leaflet's Polyline component expects to receive values for 'positions' attribute in the order of latitude first and longitude second. (https://react-leaflet.js.org/docs/api-components/#polyline) 'LatLngExpression' type's name hints to the correct order.
Author
|
Hello there, Tiago! I'm not very well-versed in creating pull requests, so I hope I've done everything correctly. Would love to hear your feedback! |
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.
OSRM API's routing service returns coordinates in the order of longitude first and latitude second. For some reason the OSRM's docs don't explicitly specify that, but you can check that by sending a request to their api endpoint. Currently the trip service's (*OsrmApiResponse).ToProto() method parses the data in incorrect order, thus making latitude value be longitude and vice versa.
Additionally, react-leaflet's Polyline component expects to receive values for 'positions' attribute in the order of latitude first and longitude second. (https://react-leaflet.js.org/docs/api-components/#polyline) 'LatLngExpression' type's name hints to the correct order.