コード例 #1
0
 private void showDistance() {
   double distance =
       SphericalUtil.computeDistanceBetween(mMarkerA.getPosition(), mMarkerB.getPosition());
   mTextView.setText("The markers are " + formatNumber(distance) + " apart.");
 }
コード例 #2
0
 /**
  * Get the latitude distance in the middle longitude
  *
  * @param minLatitude
  * @param maxLatitude
  * @return
  */
 public static double getLatitudeDistance(double minLatitude, double maxLatitude) {
   LatLng lowerMiddle = new LatLng(minLatitude, 0);
   LatLng upperMiddle = new LatLng(maxLatitude, 0);
   double latDistance = SphericalUtil.computeDistanceBetween(lowerMiddle, upperMiddle);
   return latDistance;
 }