Locate a facility through geographic location.

        >>> RADInfo().geo('geometric_type_code', '001')
335324
def geo(self, column=None, value=None, **kwargs):
        
        return self._resolve_call('RAD_GEO_LOCATION', column, value, **kwargs)
172905
function (successFn, errorFn) {
    successFn = successFn || emptyFn;
    errorFn = errorFn || emptyFn;
    RNBackgroundGeolocation.getStationaryLocation(successFn, errorFn);
  }
99126
function(location) {
  var error;

  if (!Array.isArray(location)) {
    error = "location must be an array";
  }
  else if (location.length !== 2) {
    error = "expected array of length 2, got length " + location.length;
  }
  else {
    var latitude = location[0];
    var longitude = location[1];

    if (typeof latitude !== "number" || isNaN(latitude)) {
      error = "latitude must be a number";
    }
    else if (latitude < -90 || latitude > 90) {
      error = "latitude must be within the range [-90, 90]";
    }
    else if (typeof longitude !== "number" || isNaN(longitude)) {
      error = "longitude must be a number";
    }
    else if (longitude < -180 || longitude > 180) {
      error = "longitude must be within the range [-180, 180]";
    }
  }

  if (typeof error !== "undefined") {
    throw new Error("Invalid WildGeo location '" + location + "': " + error);
  }
}
895701
def get(geo_coord, mode=2, verbose=True):
    
    if not isinstance(geo_coord, tuple) or not isinstance(geo_coord[0], float):
        raise TypeError('Expecting a tuple')

    _rg = RGeocoder(mode=mode, verbose=verbose)
    return _rg.query([geo_coord])[0]
1247345
def encode_location(location: BioCLocation):
    """"""
    return etree.Element('location',
                         {'offset': str(location.offset), 'length': str(location.length)})
888855
def geo_search(self, radius, node=None, center=False, **kwargs):
        ''''''
        node = as_node(node if node is not None else self)

        G = self.subgraph(**kwargs)

        pos = nx.get_node_attributes(G, 'pos')
        if not pos:
            return []
        nodes, coords = list(zip(*pos.items()))
        kdtree = KDTree(coords)  # Cannot provide generator.
        indices = kdtree.query_ball_point(pos[node], radius)
        return [nodes[i] for i in indices if center or (nodes[i] != node)]
473607
def get_location(query, format, api_key):
    """"""

    # Play nice with the API...
    sleep(1)
    geolocator = OpenCage(api_key=api_key, timeout=10)

    # Variables for storing the data
    data = {"city": None,
            "address_1": None,
            "postal_code": None,
            "country": None,
            "county": None,
            "state": None,
            "country_code": None,
            "latitude": None,
            "longitude": None,
            "continent": None}
    road = ""
    number = ""
    # Default None values
    location_data = {"city": None,
                     "road": None,
                     "house_number": None,
                     "postcode": None,
                     "country": None,
                     "county": None,
                     "state": None,
                     "ISO_3166-1_alpha-2": None,
                     "country_code": None,
                     "lat": None,
                     "lng": None}

    # Reverse geocoding ... from coordinates to address
    if format == "reverse":
        # If the query (coordinates) is not empty
        if query is None or len(query) < 3:
            pass
        else:
            location = geolocator.reverse(query)
            if location is not None:
                location_data = location[0].raw[u'components']
                location_data["lat"] = location[0].raw[u'geometry']["lat"]
                location_data["lng"] = location[0].raw[u'geometry']["lng"]
    # Direct geocoding ... from address to coordinates and full address
    if format == "direct":
        # If the query (address) is not empty
        if query is None or len(query) < 3:
            pass
        else:
            location = geolocator.geocode(query)
            if location is not None:
                location_data = location.raw[u'components']
                location_data["lat"] = location.raw[u'geometry']["lat"]
                location_data["lng"] = location.raw[u'geometry']["lng"]

    # Extract the meaningful data
    for component in location_data:
        if component == "town" or component == "city":
            data["city"] = location_data[component]
        if component == "road":
            road = location_data[component]
        if component == "house_number":
            number = location_data[component]
        if component == "postcode":
            data["postal_code"] = location_data[component]
        if component == "country":
            data["country"] = location_data[component]
        if component == "county":
            data["county"] = location_data[component]
        if component == "state":
            data["state"] = location_data[component]
        if component == "ISO_3166-1_alpha-2":
            data["country_code"] = location_data[component]
    # The address need to be reconstructed
    data["address_1"] = unicode(road) + " " + unicode(number)
    data["latitude"] = location_data["lat"]
    data["longitude"] = location_data["lng"]
    # Format the country code to three letters
    try:
        country_data = transformations.cca2_to_ccn(data["country_code"])
        data["country_code"] = transformations.ccn_to_cca3(country_data)
    except:
        data["country_code"] = None
    # Get the continent
    try:
        country_data = transformations.cc_to_cn(data["country_code"])
        data["continent"] = transformations.cn_to_ctn(country_data)
    except:
        data["continent"] = None

    # Return the final data
    return data
1251556
def geocode(lat, lon, options = {})
      new(options.merge(lat: lat, lon: lon)).retrieve
    end
301449
public static GeoDistanceQuery geoDistance(double locationLon, double locationLat, String distance) {
        return new GeoDistanceQuery(locationLon, locationLat, distance);
    }
559396
public GeocodeApiResponse.Location getLocation() {
        final GeocodeApiResponse.Result firstResult = firstResult(apiResponse);
        if(firstResult == null) {
            return null;
        }
        final GeocodeApiResponse.Geometry geometry = firstResult.getGeometry();
        if (geometry == null) {
            return null;
        }
        return geometry.getLocation();
    }
260119
def get(self, point, buffer_size=0, multiple=False):
        
        lon, lat = point
        geohash = Geohash.encode(lat, lon, precision=self.precision)
        key = (geohash, buffer_size, multiple)
        if key in self.geohash_cache:
            # cache hit on geohash
            self.hit += 1
            #print self.hit, self.miss
            return self.geohash_cache[key]
        self.miss += 1
        # cache miss on geohash
        # project point to ESRI:102005
        lat, lon = Geohash.decode(geohash)
        proj_point = project([float(lon), float(lat)])
        args = dict(buffer_size=buffer_size, multiple=multiple)
        payload = self.get_object(proj_point, **args)
        self.geohash_cache[key] = payload
        return payload
1352533
def get_special_location(self, special_location=0):
        
        try:
            return(self.process.GetSpecialLocation(special_location))
        except Exception as e: 
            print(e)
            print("Could not retreive special location")
721697
def location_filter(files_with_tags, location, radius):
    '''
    
    '''
    on_location = dict()
    for f, tags in files_with_tags.items():
        if 'GPS GPSLatitude' in tags:
            try:
                lat = convert_to_decimal(str(tags['GPS GPSLatitude']))
                long = convert_to_decimal(str(tags['GPS GPSLongitude']))
            except ValueError:
                print('{0} has invalid gps info'.format(f))
            try:
                if haversine(lat, long, location['lat'], location['long']) < radius:
                    on_location[f] = tags
            except InvalidCoordinate:
                print('{0} has invalid gps info'.format(f))
    return on_location
621647
function locationToPoint(loc) {
  var lat, lng, radius, cosLat, sinLat, cosLng, sinLng, x, y, z;

  lat = loc.lat * Math.PI / 180.0;
  lng = loc.lng * Math.PI / 180.0;
  radius = loc.elv + getRadius(lat);
  cosLng = Math.cos(lng);
  sinLng = Math.sin(lng);
  cosLat = Math.cos(lat);
  sinLat = Math.sin(lat);
  x = cosLng * cosLat * radius;
  y = sinLng * cosLat * radius;
  z = sinLat * radius;

  return { x: x, y: y, z: z, radius: radius };
}
951867
function findStoresInRangeLocation(location, range, callback) {
  range = range || 3;

  geo.reverseGeocode(location, function(err, georesult) {
    if (err) return callback(err);
    findStoresInRange(georesult, range, callback);
  });
}
1081491
def randomLocation(cls, radius, width, height, origin=None):
        '''
        
        '''
        return cls(width,
                   height,
                   Point.randomLocation(radius, origin))
906207
def geo(self, *args, **kwargs):
        
        compare = Geographic(*args, **kwargs)
        self.add(compare)

        return self