Add a geo distance query.

@param string $field
@param string $distance
@param mixed  $location
@param array  $attributes

@return $this
968200
public function geoDistance($field, $distance, $location, array $attributes = [])
    {
        $query = new GeoDistanceQuery($field, $distance, $location, $attributes);

        $this->append($query);

        return $this;
    }
406104
public function setGeoLocation($geoLocation)
    {
        self::writeFullTag(
            $geoLocation,
            'geo_location',
            true,
            'image:geo_location',
            $this->validator,
            'validateGeoLocation',
            $this->exception,
            'Provided geo_location is not a valid value.'
        );

        return $this;
    }
896844
@Override
    public IDocumentQuery<T> orderByDistance(String fieldName, String shapeWkt) {
        _orderByDistance(fieldName, shapeWkt);
        return this;
    }
111784
private void addLocationsToBuilder(Element element, BeanDefinitionBuilder builder) {
        Element locationsElement = DomUtils.getChildElementByTagName(element, LOCATIONS);
        if (locationsElement != null) {
            List<Element> locationElements = DomUtils.getChildElementsByTagName(locationsElement, LOCATION);

            List<String> locations = locationElements.stream()
                    .map(locationElement -> locationElement.getAttribute("path"))
                    .collect(Collectors.toList());

            if (!locations.isEmpty()) {
                builder.addPropertyValue(LOCATIONS, locations);
            }
        }
    }
1024198
public static Builder distanceFrom(String fieldName) {

		Assert.hasText(fieldName, "FieldName must not be empty!");
		return distanceFrom(new SimpleField(fieldName));
	}
677216
function select_geo($table, $latitude, $longitude, $radius = 0, $results = 0, $miles = true, $additional_where = false) {
		if (!empty($this->prefix) && !(substr_count($table,$this->prefix) > 0)) {
			$table = $this->prefix."_".$table;
        }
		$coord_cols = $this->geo_detect_coord_cols($table);

		$q = "SELECT *, (".($miles ? "3959" : "6371")." * acos(cos(radians(".$latitude.")) * cos(radians(".$this->lat_col.")) * cos(radians(".$this->lon_col.") - radians(".$longitude.")) + sin(radians(".$latitude.")) * sin(radians(".$this->lat_col.")))) AS distance FROM ".$this->encapsulate_column_name($table);

		if ($radius > 0) { $q .= " HAVING distance < ".$radius; }
		if ($additional_where !== false) { $q.= "WHERE $additional_where"; }
		$q .= " ORDER BY distance";
		if ($results > 0) { $q .= " LIMIT $results;"; }

		return $this->query($q);
	}
699553
public function addSubmenu($title, array $attributes = array(), $location = null)
	{
		return $this->addItemInstance($this->makeSubmenu($title, $attributes), $location);
	}
1243645
public function searchLocation($lat, $lng, $distance = 1000)
    {
        return $this->_makeCall('locations/search', false, array('lat' => $lat, 'lng' => $lng, 'distance' => $distance));
    }
1095289
function addIndex( $attributes ) {
		$name = strtoupper( $attributes['NAME'] );
		$this->indexes[$name] = new dbIndex( $this, $attributes );
		return $this->indexes[$name];
	}
1067880
public function file($field, array $attributes = array())
	{
		if (is_array($field))
		{
			$attributes = $field;
		}
		else
		{
			$attributes['name'] = (string) $field;
		}
		$attributes['type'] = 'file';

		return $this->input($attributes);
	}
611713
public function commonTerm($field, $term, array $attributes = [])
    {
        $query = new CommonTermsQuery($field, $term, $attributes);

        $this->append($query);

        return $this;
    }
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
934751
public static Coordinate createCoordinate(Attributes attributes) throws NumberFormatException {
        // Associate a latitude and a longitude to the point
        double lat;
        double lon;
        try {
            lat = Double.parseDouble(attributes.getValue(GPXTags.LAT));
        } catch (NumberFormatException e) {
            throw new NumberFormatException("Cannot parse the latitude value");
        }
        try {
            lon = Double.parseDouble(attributes.getValue(GPXTags.LON));
        } catch (NumberFormatException e) {
            throw new NumberFormatException("Cannot parse the longitude value");
        }
        String eleValue = attributes.getValue(GPXTags.ELE);
        double ele = Double.NaN;
        if (eleValue != null) {
            try {
                ele = Double.parseDouble(eleValue);

            } catch (NumberFormatException e) {
                throw new NumberFormatException("Cannot parse the elevation value");
            }
        }        
        return new Coordinate(lon, lat, ele);
    }
244245
protected function insertAndSetId(BaseBuilder $query, $attributes)
	{
		// This allows values that are set by Kinvey, and returned in the
		// inserted model ('_kmd', '_acl' etc.) to be immediately added
		// to the new model instance.

		$result = $query->insert($attributes);

		$this->setRawAttributes(reset($result));
	}
1222619
public function addLocation($location)
    {
        $this->setLocations(
            array_unique(
                array_merge(
                    $this->getLocations(),
                    [$location]
                )
            )
        );

        return $this;
    }
369883
private function buildQuery($table, $attributes = [])
    {
        if (class_exists($table)) {
            $query = $this->getQueryBuilderFromModel($table);
        } else {
            $query = $this->getQueryBuilderFromTable($table);
        }

        foreach ($attributes as $key => $value) {
            if (\is_array($value)) {
                call_user_func_array(array($query, "where"), $value);
            } elseif (is_null($value)) {
                $query->whereNull($key);
            } else {
                $query->where($key, $value);
            }
        }
        return $query;
    }
271448
public function addOrder($field, $direction = SORT_ASC) {
		$this->query[self::ORDER][ $field ] = $direction;
		return $this;
	}