Returns location, (latitude, longitude) from json feed.
488730
def _parse_json(self, page, exactly_one):
        """"""

        if not page.get('success'):
            return None

        latitude = page['latitude']
        longitude = page['longitude']

        place = page.get('place')
        address = ", ".join([place['city'], place['countryCode']])
        result = Location(address, (latitude, longitude), page)
        if exactly_one:
            return result
        else:
            return [result]
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, )
324992
def format(self, **kwargs):
        """"""
        attrs = self._attrs.copy()
        attrs.update(kwargs)
        lat, lon = self.lat_lon
        return type(self)(lat, lon, **attrs)
145626
def _from_json(json_data):
        
        if len(json_data) >= 3:
            return Coordinate(_parse_float(json_data[0]),
                        _parse_float(json_data[1]),
                        _parse_float(json_data[2]))
        else:
            raise USGSException("The given coordinate information was incomplete.")
551260
def _geolocation_extract(response):
    
    body = response.json()
    if response.status_code in (200, 404):
        return body

    try:
        error = body["error"]["errors"][0]["reason"]
    except KeyError:
        error = None

    if response.status_code == 403:
        raise exceptions._OverQueryLimit(response.status_code, error)
    else:
        raise exceptions.ApiError(response.status_code, error)
392876
def get_woeid(lat, lon):
    """"""
    yql = _YQL_WOEID.format(lat, lon)

    # send request
    tmpData = _yql_query(yql)

    if tmpData is None:
        _LOGGER.error("No woid is received!")
        return None

    # found woid?
    return tmpData.get("place", {}).get("woeid", None)
524319
def by_location(self, location, cc=None):
        

        header, content = self._http_request(self.BASE_URL, location=location, cc=cc)		
        return json.loads(content)
392713
def latitude(self):
        ''''''
        sd = dm_to_sd(self.lat)
        if self.lat_dir == 'N':
            return +sd
        elif self.lat_dir == 'S':
            return -sd
        else:
            return 0.
590910
def _get_json(location):
    """"""
    location = os.path.expanduser(location)
    try:
        if os.path.isfile(location):
            with io.open(location, encoding="utf-8") as json_data:
                return json.load(json_data, object_pairs_hook=OrderedDict).get("tests")
        elif "http" in location:
            json_data = requests.get(location)
            if not json_data:
                raise Dump2PolarionException("Failed to download")
            return json.loads(json_data.text, object_pairs_hook=OrderedDict).get("tests")
        else:
            raise Dump2PolarionException("Invalid location")
    except Exception as err:
        raise Dump2PolarionException("Failed to parse JSON from {}: {}".format(location, err))
206014
def location_gmap(context, location):
    """"""
    gmapq = None
    if getattr(MapFieldPanel, "UsingWagtailGMaps", False):
        gmapq = location
    return {'gmapq': gmapq}
1092242
def get_coordinates_by_nickname(self, nickname):
        """"""
        person = self.get_person_by_nickname(nickname)
        if not person:
            return '', ''
        return person.latitude, person.longitude
1359568
def get_lats():
  
  lats = {}
  fname = pkg_resources.resource_filename(__name__, 'resources/Latitudes-Longitudes.csv')
  with open(fname, 'rb') as csvfile:
    # Read latitude/longitude coordinates
    reader = csv.reader(csvfile, delimiter = ',')
    for row in reader:
      word = row[0].lower()
      word = re.sub(' ', '', word)
      lats[word] = float(row[1])

  return lats
1299999
def _get_geocoding(self, key, location):
        """"""

        url = self._location_query_base % quote_plus(key)
        if self.api_key:
            url += "&key=%s" % self.api_key
        data = self._read_from_url(url)
        response = json.loads(data)
        if response["status"] == "OK":
            formatted_address = response["results"][0]["formatted_address"]
            pos = formatted_address.find(",")
            if pos == -1:
                location.name = formatted_address
                location.region = ""
            else:
                location.name = formatted_address[:pos].strip()
                location.region = formatted_address[pos + 1 :].strip()

            geo_location = response["results"][0]["geometry"]["location"]
            location.latitude = float(geo_location["lat"])
            location.longitude = float(geo_location["lng"])
        else:
            raise AstralError("GoogleGeocoder: Unable to locate %s. Server Response=%s" %
                              (key, response["status"]))
286727
def get_lonlats(self):
        """"""
        longitudes = self.get_sds_variable('Longitude')
        latitudes = self.get_sds_variable('Latitude')
        return longitudes, latitudes
834283
def get_locations_from_coords(self, longitude, latitude, levels=None):
        
        resp = requests.get(SETTINGS['url'] + '/point/4326/%s,%s?generation=%s' % (longitude, latitude, SETTINGS['generation']))
        resp.raise_for_status()

        geos = []
        for feature in resp.json().itervalues():
            try:
                geo = self.get_geography(feature['codes']['MDB'],
                                         feature['type_name'].lower())

                if not levels or geo.geo_level in levels:
                    geos.append(geo)
            except LocationNotFound as e:
                log.warn("Couldn't find geo that Mapit gave us: %s" % feature, exc_info=e)

        return geos
271304
def get_center_from_json(cls, data):
        
        center_lat = None
        center_lon = None
        center = data.get("center")
        if isinstance(center, dict):
            center_lat = center.get("lat")
            center_lon = center.get("lon")
            if center_lat is None or center_lon is None:
                raise ValueError("Unable to get lat or lon of way center.")
            center_lat = Decimal(center_lat)
            center_lon = Decimal(center_lon)
        return (center_lat, center_lon)
47362
def longitude(self):
        
        try:
            scripts = self._ad_page_content.find_all('script')
            for script in scripts:
                if 'longitude' in script.text:
                    find_list = re.findall(
                        r'"longitude":"([\-]?[0-9.]*[0-9]+)"', script.text)
                    if len(find_list) >= 1:
                        return find_list[0]
            return None
        except Exception as e:
            if self._debug:
                logging.error(
                    "Error getting longitude. Error message: " + e.args[0])
            return None