Exemplo n.º 1
0
    def parse_matched(self, matched):
        latsign = ServiceQuery._get_matched_var(matched, 0, "latsign")
        latdec = ServiceQuery._get_matched_var(matched, 1, "latdec")
        latfrac = ServiceQuery._get_matched_var(matched, 2, "latfrac")
        self._lat = GeoCodeUtils.aiml_string_to_float(latsign, latdec, latfrac)

        lngsign = ServiceQuery._get_matched_var(matched, 3, "lngsign")
        lngdec = ServiceQuery._get_matched_var(matched, 4, "lngdec")
        lngfrac = ServiceQuery._get_matched_var(matched, 5, "lngfrac")
        self._lng = GeoCodeUtils.aiml_string_to_float(lngsign, lngdec, lngfrac)
Exemplo n.º 2
0
    def aiml_response(self, response):
        payload = response['response']['payload']
        postalCodes = payload['postalCodes']
        lat = postalCodes[0]['lat']
        lng = postalCodes[0]['lng']

        latText = GeoCodeUtils.float_to_aiml_string(lat)
        lngText = GeoCodeUtils.float_to_aiml_string(lng)

        result = GeoCodeUtils.aiml_lat_lng(latText, lngText)
        YLogger.debug(self, result)
        return result
Exemplo n.º 3
0
    def aiml_response(self, response):
        payload = response['response']['payload']
        results = payload['results']
        result = results[0]
        geometry = result['geometry']
        location = geometry['location']

        lat = location['lat']
        lng = location['lng']

        latText = GeoCodeUtils.float_to_aiml_string(lat)
        lngText = GeoCodeUtils.float_to_aiml_string(lng)

        result = GeoCodeUtils.aiml_lat_lng(latText, lngText)
        YLogger.debug(self, result)
        return result