Returns every object within dist (miles)
 of lat/long

 @param  lat [Float] [A latitude position]
 @param  long [Float] [A longitude position]
 @param  dist [Float] [A radius in miles]

 @return [Array] [Array of objects within dist of lat/long]
964968
def all_within(lat, long, dist)
      @data.select { |d| d.distance_from(lat, long) < dist }
    end
216274
def geo_distance_range(cls, field, center, from_distance, to_distance, distance_type=None):
        '''
        


        '''
        instance = cls(geo_distance_range={'from': from_distance, 'to': to_distance, field: center})
        if distance_type is not None:
            instance['geo_distance_range']['distance_type'] = distance_type
        return instance
145036
def _compute_distance(cls, dists, coeffs):
        
        return coeffs['b3']*np.log10(np.sqrt(dists.rjb**2. + coeffs['b4']**2.))
925603
@SuppressWarnings({ "cast", "unchecked" })
  public static <O extends SpatialComparable> RangeQuery<O> getRangeQuery(AbstractRStarTree<?, ?, ?> tree, SpatialDistanceQuery<O> distanceQuery, Object... hints) {
    // Can we support this distance function - spatial distances only!
    SpatialPrimitiveDistanceFunction<? super O> df = distanceQuery.getDistanceFunction();
    if(EuclideanDistanceFunction.STATIC.equals(df)) {
      return (RangeQuery<O>) new EuclideanRStarTreeRangeQuery<>(tree, (Relation<NumberVector>) distanceQuery.getRelation());
    }
    return new RStarTreeRangeQuery<>(tree, distanceQuery.getRelation(), df);
  }
779318
def Distance(lat1, lon1, lat2, lon2):
    """"""

    az12, az21, dist = wgs84_geod.inv(lon1, lat1, lon2, lat2)
    return az21, dist
668769
def within(self, lat, lon, radius):
		''''''
		return self.filter(filter_helpers.within_(lat, lon, radius))
343884
@Override
    public final long encode(double lat, double lon) {
        // PERFORMANCE: int operations would be faster than double (for further comparison etc)
        // but we would need 'long' because 'int factorForPrecision' is not enough (problem: coord!=decode(encode(coord)) see testBijection)
        // and 'long'-ops are more expensive than double (at least on 32bit systems)
        long hash = 0;
        double minLatTmp = bbox.minLat;
        double maxLatTmp = bbox.maxLat;
        double minLonTmp = bbox.minLon;
        double maxLonTmp = bbox.maxLon;
        int i = 0;
        while (true) {
            if (minLatTmp < maxLatTmp) {
                double midLat = (minLatTmp + maxLatTmp) / 2;
                if (lat < midLat) {
                    maxLatTmp = midLat;
                } else {
                    hash |= 1;
                    minLatTmp = midLat;
                }
            }
            i++;

            if (i < allBits)
                hash <<= 1;
            else
                // if allBits is an odd number
                break;

            if (minLonTmp < maxLonTmp) {
                double midLon = (minLonTmp + maxLonTmp) / 2;
                if (lon < midLon) {
                    maxLonTmp = midLon;
                } else {
                    hash |= 1;
                    minLonTmp = midLon;
                }
            }
            i++;
            if (i < allBits)
                hash <<= 1;
            else
                break;
        }
        return hash;
    }
452805
def __get_ws_distance(wstation, latitude, longitude):
    
    if wstation:
        try:
            wslat = float(wstation[__LAT])
            wslon = float(wstation[__LON])

            dist = vincenty((latitude, longitude), (wslat, wslon))
            log.debug("calc distance: %s (latitude: %s, longitude: "
                      "%s, wslat: %s, wslon: %s)", dist, latitude,
                      longitude, wslat, wslon)
            return dist
        except (ValueError, TypeError, KeyError):
            # value does not exist, or is not a float
            return None
    else:
        return None
143728
def __get_ws_distance(wstation, latitude, longitude):
    
    if wstation:
        try:
            wslat = float(wstation[__BRLAT])
            wslon = float(wstation[__BRLON])

            dist = vincenty((latitude, longitude), (wslat, wslon))
            log.debug("calc distance: %s (latitude: %s, longitude: "
                      "%s, wslat: %s, wslon: %s)", dist, latitude,
                      longitude, wslat, wslon)
            return dist
        except (ValueError, TypeError, KeyError):
            # value does not exist, or is not a float
            return None
    else:
        return None
706237
def distance(coordinates)
      coordinates = coordinates.center if coordinates.respond_to?(:center)
      Math.sqrt([center, coordinates].transpose.map {|a,b| (b - a)**2}.reduce {|d1,d2| d1 + d2})
    end
472469
def from_points(lons, lats):
        
        north, west = max(lats), min(lons)
        south, east = min(lats), max(lons)
        return BoundingBox(north=north, west=west, south=south, east=east)
1071786
private static double distanceRadians(double lat1, double lng1, double lat2, double lng2) {
        return arcHav(havDistance(lat1, lat2, lng1 - lng2));
    }
445891
def _compute_distance(self, dists, C):
        
        return C["c4"] * np.log(np.sqrt(dists.rrup ** 2. + C["h"] ** 2.))
1177723
@Override
	@Pure
	public <OT extends MapPonctualElement> double distance(OT another_point) {
		double dist = super.distance(another_point);
		dist -= this.radius;
		return dist;
	}
541197
public static function LL2Utm( string $ellipsoid, $lat, $long )
   {

      if ( ! isset( Ellipsoid::$Ellipsoid[ $ellipsoid ] ) )
      {
         // The defined ellipsoid does not exist.
         return false;
      }

      // Get the longitude decimal value
      $ln = ( ( $long instanceof AbstractElement )
         ? $long->getDecimalValue()
         : ( \is_double( $long ) ? $long : \doubleval( $long ) )
      );

      // Get the latitude decimal value
      $lt = ( ( $lat instanceof AbstractElement )
         ? $lat->getDecimalValue()
         : ( \is_double( $lat ) ? $lat : \doubleval( $lat ) )
      );

      // Init some required parameters
      $longOrigin      = null;
      $eccPrimeSquared = null;
      $longOriginRad   = null;
      $k0              = 0.9996;

      // Doing the calculation
      $a               = Ellipsoid::$Ellipsoid[ $ellipsoid ][ 0 ];
      $eccSquared      = Ellipsoid::$Ellipsoid[ $ellipsoid ][ 1 ];
      $N = null; $T = null; $C = null; $A = null; $M = null;
      $longTemp        = ( $ln + 180.0 ) - \intval( ( $ln + 180 ) / 360 ) * 360 - 180;
      $latRad          = $lt * self::DEG2RAD;
      $longRad         = $longTemp * self::DEG2RAD;
      $zoneNumber      = \intval( ( $longTemp + 180 ) / 6 ) + 1;

      if ( $lt >= 56.0 && $lt < 64.0 && $longTemp >= 3.0 && $longTemp < 12.0 )
      {
         $zoneNumber = 32;
      }

      if ( $lt >= 72.0 && $lt < 84.0 )
      {
         if ( $longTemp >= 0.0  && $longTemp <  9.0 )
         {
            $zoneNumber = 31;
         }
         else if ( $longTemp >= 9.0  && $longTemp < 22.0 )
         {
            $zoneNumber = 33;
         }
         else if ( $longTemp >= 22.0 && $longTemp < 33.0 )
         {
            $zoneNumber = 35;
         }
         else if ( $longTemp >= 33.0 && $longTemp < 42.0 )
         {
            $zoneNumber = 37;
         }
      }

      $longOrigin    = ( $zoneNumber - 1 ) * 6 - 180 + 3;
      $longOriginRad = $longOrigin * self::DEG2RAD;
      $UTMZone       = \sprintf(
         '%d%s',
         $zoneNumber,
         self::UTMLetterDesignator($lt)
      );

      $eccPrimeSquared = ( $eccSquared ) / ( 1 - $eccSquared );
      $N               = $a / \sqrt( 1 - $eccSquared * \sin( $latRad ) * \sin( $latRad ) );
      $T               = \tan( $latRad ) * \tan( $latRad );
      $C               = $eccPrimeSquared * \cos( $latRad ) * \cos( $latRad );
      $A               = \cos( $latRad ) * ( $longRad - $longOriginRad );
      $M               = $a * (
            ( 1 - $eccSquared/4 - 3 * $eccSquared * $eccSquared/64 - 5 * $eccSquared * $eccSquared * $eccSquared / 256 )
            * $latRad
            - (3 * $eccSquared/8 + 3 * $eccSquared * $eccSquared/32 + 45 * $eccSquared * $eccSquared * $eccSquared/1024)
              * \sin( 2 * $latRad )
            + ( 15 * $eccSquared * $eccSquared / 256 + 45 * $eccSquared * $eccSquared * $eccSquared / 1024 )
              * \sin( 4 * $latRad )
            - ( 35 * $eccSquared * $eccSquared * $eccSquared / 3072) * \sin( 6 * $latRad )
         );

      $UTMEasting = (double) ( $k0 * $N * ( $A + ( 1 - $T + $C ) * $A * $A * $A / 6
                                            + ( 5 - 18 * $T + $T * $T + 72 * $C - 58 * $eccPrimeSquared )
                                              * $A * $A * $A * $A * $A / 120 ) + 500000.0
      );
      $UTMEasting = \round( $UTMEasting, 0 );
      $UTMNorthing = (double) ( $k0
                                * ( $M + $N * \tan( $latRad ) * ( $A * $A / 2 + ( 5 - $T + 9 * $C + 4 * $C * $C )
                                                                                * $A * $A * $A * $A / 24 + ( 61 - 58 * $T + $T * $T + 600 * $C - 330 * $eccPrimeSquared )
                                                                                                           * $A * $A * $A * $A * $A * $A / 720 ) )
      );

      if ( $lt < 0 )
      {
         $UTMNorthing += 10000000.0;
      }

      $UTMNorthing = \round( $UTMNorthing, 0 );

      return "{$UTMZone} E {$UTMEasting} N {$UTMNorthing}";

   }
606822
def get_latlon(self, use_cached=True):
        """"""
        device_json = self.get_device_json(use_cached)
        lat = device_json.get("dpMapLat")
        lon = device_json.get("dpMapLong")
        return (float(lat) if lat else None,
                float(lon) if lon else None, )
1262797
public static double latLonDist(double lon1, double lat1, double lon2,
			double lat2) {

		double[] aux;
		try {
			aux = PIGbsl(lon1, lat1, lon2, lat2, Ellipsoid.WGS84);
		} catch (Exception e) {
			// Calculator.debugThis(true, "Error while getting dist: " +
			// e.getMessage(), logger);
			return Double.MAX_VALUE;
		}
		return aux[2];
	}