Note that there are some explanatory texts on larger screens.

plurals
  1. POGet Latitude-Longitude Value from Distance value from Drawing Route in Android
    text
    copied!<p>I have two Geopoints </p> <pre><code>GeoPoint gp1; GeoPoint gp2; </code></pre> <p>I also have distance between these two geopoints. As of now it is 174 km. I need accurate middle geopoint between this two geopoint's so how can I get Middle GeoPoint.</p> <p>Above two GeoPoint is Part of Route Draw which is not straight so i need Middle Point of Drawing route not straight line </p> <p>my code:</p> <pre><code>List&lt;GeoPoint&gt; _geopoints = decodePoly(_path); GeoPoint gp1; GeoPoint gp2; gp2 = _geopoints.get(0); System.out.println("gp2 "+gp2); System.out.println("_geopoints"+_geopoints.size()); System.out.println("_midgeopoint"+_geopoints.size()/2); mGeoPointMiddleOne=_geopoints.get(_geopoints.size()/2); private List&lt;GeoPoint&gt; decodePoly(String encoded) { List&lt;GeoPoint&gt; poly = new ArrayList&lt;GeoPoint&gt;(); int index = 0, len = encoded.length(); int lat = 0, lng = 0; while (index &lt; len) { int b, shift = 0, result = 0; do { b = encoded.charAt(index++) - 63; result |= (b &amp; 0x1f) &lt;&lt; shift; shift += 5; } while (b &gt;= 0x20); int dlat = ((result &amp; 1) != 0 ? ~(result &gt;&gt; 1) : (result &gt;&gt; 1)); lat += dlat; shift = 0; result = 0; do { b = encoded.charAt(index++) - 63; result |= (b &amp; 0x1f) &lt;&lt; shift; shift += 5; } while (b &gt;= 0x20); int dlng = ((result &amp; 1) != 0 ? ~(result &gt;&gt; 1) : (result &gt;&gt; 1)); lng += dlng; GeoPoint p = new GeoPoint((int) (((double) lat / 1E5) * 1E6), (int) (((double) lng / 1E5) * 1E6)); poly.add(p); } return poly; } </code></pre> <p>above function decoePoly(path) is responsible for drawing route between two geopoints so i get route between two points.</p> <p>and i also get distance between these two geopoints from calling Google map api for drawing route which is below</p> <pre><code>http://maps.googleapis.com/maps/api/directions/xml? origin=52.31,16.71&amp;destination=51.27,6.75&amp;sensor=false </code></pre> <p>so i get distance between two points from tag in web services </p> <p>so my requirment is how can i get latitude-longitude at middle distance value from this route?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload