title: Android Google Maps - How to divide Google Maps route in equal segments?
body: <p>In my custom Google Maps, I draw a route between two locations (say Pune to Mumbai) using this URL</p>
  
  <pre><code>https://maps.googleapis.com/maps/api/directions/json?origin=Pune&amp;destination=Mumbai&amp;sensor=false&amp;mode=driving&amp;alternatives=false
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lvx9L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lvx9L.png" alt="enter image description here"></a></p>
  
  <p>Parsing this response I get number of points between source and destination and store it in <code>ArrayList</code></p>
  
  <pre><code>ArrayList&lt;LocationModel&gt; listAllPoints = getPoints();
  </code></pre>
  
  <p>This <code>ArrayList</code> contains around 2600 points.</p>
  
  <p>My question is, how can I divide this route in 10 equal segments, i.e. total 11 points including source and destination. Like this</p>
  
  <p>| A | B | C | D | E | F | G | H | I | J |</p>
  
  <p>Where | = each point, Character = segment</p>
  
  <p>Distance between A and B, B and C, C and D should be equal.</p>
  
  <p>I should be able to do this by dividing <code>listAllPoints</code> in 11 Parts, but problem is that, points inside <code>listAllPoints</code> are not scattered uniformly.</p>
  
  <p>Any help will be greatly appreciated.</p>