bramus / react-native-maps-directions

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

Is there any limit for waypoints? #110

Closed ppv94 closed 4 years ago

ppv94 commented 5 years ago

If we give 4 to 7 coordinates in waypoints, the map works fine, if we exceed more than 10 waypoints app crashes in the real device. is there any limit for waypoints in react-native-map-directions.

bramus commented 5 years ago

There is no hard limit on waypoints, although Google will bill more for a request that has more than 10 waypoints.

Can you debug this a bit more?

ppv94 commented 5 years ago

@bramus ---> yes the Directions API request succeeds when there are 6 to 7 waypoints but when there are 10 to 15 waypoints initially markers are displayed on the map but the route is not displayed and app crashes on the real device but works fine in simulator

---> error I got when the app crashes Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 21. Wait queue head age: 5508.7ms.)

---> I am using (precision="high")

bramus commented 5 years ago

Since you're using the precision="high" option, you are requesting React Native Maps to draw a huge Polyline (one with many details and legs). This is why the app crashes: the device cannot handle it.

💡 For routes with many waypoints it is recommended to draw the overview polyline.

Other ideas:

  1. React Native Maps directions should draw several polylines (one for each part of the route) instead of one big Polyline (👉 feel to PR this)
  2. File an issue with React Native Maps that it crashes when drawing a huge polyline. Perhaps they should provide the split into multiple components internally?
bramus commented 4 years ago

Closing this issue due to inactivity.