bramus / react-native-maps-directions

Directions Component for `react-native-maps`
MIT License
1.25k stars 197 forks source link

Render Pre-existing JSON Directions Data in Map #201

Open blitzve0 opened 2 years ago

blitzve0 commented 2 years ago

Hi I have already saved a directions api response on my server, now i only want to load the data and render it using polyline, is their a way to solve this?

bramus commented 2 years ago

I am open to a PR that provides this.

LazyAfternoons commented 2 years ago

+1 on this feature. Storing the directions api response and sending it to this component with a prop would be nice. Thank you.

blitzve0 commented 2 years ago

+1 on this feature. Storing the directions api response and sending it to this component with a prop would be nice. Thank you.

Hi, I have actually found a solution for this since then, in the directions api response, just save the response.routes[0].overview_path This will give you the latLng array and then we can simply render this latLng array using a basic polyline on a mapview

LazyAfternoons commented 2 years ago

+1 on this feature. Storing the directions api response and sending it to this component with a prop would be nice. Thank you.

Hi, I have actually found a solution for this since then, in the directions api response, just save the response.routes[0].overview_path This will give you the latLng array and then we can simply render this latLng array using a basic polyline on a mapview

Thank you for your help. That implies not using this library at all, right?

blitzve0 commented 2 years ago

yes basically 😂😂