예제 #1
0
    def __init__(self, location, **kwargs):
        t = location.split()
        print t[0] + " " + t[1]
        self.location = str(Location(location))
        self.url = 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode'
        self.params = {
            'location':
            t[1] + "," + t[0],  # ArcGIS needs it reversed from the norm
            'f': 'json'
        }

        self._initialize(**kwargs)
예제 #2
0
 def __init__(self, location, **kwargs):
     self.url = self._get_osm_url(kwargs.get('url', ''))
     self.location = location
     location = Location(location)
     self.params = {
         'q': str(location),
         'format': 'jsonv2',
         'addressdetails': 1,
         'limit': kwargs.get('limit', 1)
     }
     print self.url
     self._initialize(**kwargs)
예제 #3
0
 def __init__(self, location, **kwargs):
     self.url = 'https://maps.googleapis.com/maps/api/geocode/json'
     self.location = str(Location(location))
     self.short_name = kwargs.get('short_name', True)
     self.params = {
         'sensor': 'false',
         'latlng': self.location,
         'key': kwargs.get('key', google_key),
         'language': kwargs.get('language', ''),
         'client': kwargs.get('client', google_client)
     }
     self._initialize(**kwargs)
예제 #4
0
    def _build_params(self, location, provider_key, **kwargs):
        params = super(HereReverse,
                       self)._build_params(location, provider_key, **kwargs)
        del params['searchtext']

        location = str(Location(location))
        params.update({
            'prox': location,
            'mode': 'retrieveAddresses',
            'gen': 8,
        })
        return params
예제 #5
0
 def __init__(self, location, **kwargs):
     self.url = 'http://restapi.amap.com/v3/geocode/regeo'
     location = Location(location)
     self._lat = location.lat
     self._lng = location.lng
     location = str(location.lng) + ',' + str(location.lat)
     self.params = {
         'location': location,
         'output': 'json',
         'key': self._get_api_key(gaode_key, **kwargs),
     }
     self._initialize(**kwargs)
예제 #6
0
    def _build_params(self, location, provider_key, **kwargs):
        location = Location(location)
        params = {
            'location': str(location),
            'ret_coordtype': kwargs.get('coordtype', 'wgs84ll'),
            'output': 'json',
            'ak': provider_key
        }
        if ('lang_code' in kwargs):
            params['accept-language'] = kwargs['lang_code']

        return params
예제 #7
0
 def __init__(self, location, **kwargs):
     self.url = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode'
     self.location = location
     location = Location(location)
     self.params = {
         'location': '{}, {}'.format(location.lng, location.lat),
         'f': 'pjson',
         'distance': kwargs.get('distance', 50000),
         'outSR': kwargs.get('outSR', ''),
         'maxLocations': kwargs.get('limit', 1),
     }
     self._initialize(**kwargs)
예제 #8
0
 def __init__(self, location, **kwargs):
     self.url = self._get_osm_url(kwargs.get('url', ''))
     self.location = location
     location = Location(location)
     self.params = {
         'q': str(location),
         'format': 'jsonv2',
         'addressdetails': 1,
         'limit': kwargs.get('limit', 1)
     }
     if ('lang_code' in kwargs):
         self.params['accept-language'] = kwargs.get('lang_code')
     self._initialize(**kwargs)
예제 #9
0
    def __init__(self, location, **kwargs):
        self.url = 'https://geocoding.geo.census.gov/geocoder/geographies/coordinates'
        self.location = location
        location = Location(location)
        self.params = {
            'x': location.longitude,
            'y': location.latitude,
            'benchmark': kwargs.get('benchmark', '4'),
            'vintage': kwargs.get('vintage', '4'),
            'format': 'json'
        }

        self._initialize(**kwargs)
예제 #10
0
 def __init__(self, location, **kwargs):
     self.url = 'http://geocode-maps.yandex.ru/1.x/'
     location = location
     x, y = Location(location).xy
     self.location = '{}, {}'.format(x, y)
     self.params = {
         'geocode': self.location,
         'lang': kwargs.get('lang', 'en-US'),
         'kind': kwargs.get('kind', ''),
         'format': 'json',
         'results': 1,
     }
     self._initialize(**kwargs)
예제 #11
0
 def __init__(self, location, **kwargs):
     self.url = 'https://www.geocode.farm/v3/json/reverse/'
     self.location = location
     location = Location(location)
     key = kwargs.get('key', geocodefarm_key)
     self.params = {
         'lat': location.latitude,
         'lon': location.longitude,
         'key': key if key else None,
         'lang': kwargs.get('lang', ''),
         'country': kwargs.get('country', ''),
     }
     self._initialize(**kwargs)
예제 #12
0
 def __init__(self, location, **kwargs):
     self.url = 'http://www.mapquestapi.com/geocoding/v1/address'
     self.location = str(Location(location))
     self.headers = {
         'referer': 'http://www.mapquestapi.com/geocoding/',
         'host': 'www.mapquestapi.com',
     }
     self.params = {
         'key': kwargs.get('key', mapquest_key),
         'location': self.location,
         'maxResults': 1,
     }
     self._initialize(**kwargs)
예제 #13
0
    def __init__(self, location, **kwargs):
        self.url = 'https://search.mapzen.com/v1/reverse'
        self.location = location
        location = Location(location)

        self.params = {
            'point.lat': location.lat,
            'point.lon': location.lng,
            'size': kwargs.get('size', 1),
            'layers': kwargs.get('layers'),
            'source': kwargs.get('sources'),
            'boundary.country': kwargs.get('country'),
            'api_key': self._get_api_key(tamu_key, **kwargs)
        }
        self._initialize(**kwargs)
예제 #14
0
 def __init__(self, location, **kwargs):
     self.url = 'http://api.map.baidu.com/geocoder/v2/'
     self.location = location
     location = Location(location)
     coordtype = 'wgs84ll'
     if 'coordtype' in kwargs:
         coordtype = kwargs['coordtype']
     self.params = {
         'location': str(location),
         'ret_coordtype': coordtype,
         'output': 'json',
         'ak': self._get_api_key(baidu_key, **kwargs),
     }
     if ('lang_code' in kwargs):
         self.params['accept-language'] = kwargs.get('lang_code')
     self._initialize(**kwargs)
예제 #15
0
    def __init__(self, location, **kwargs):
        self.url = 'https://search.mapzen.com/v1/reverse'
        self.location = location
        location = Location(location)
        key = kwargs.get('key', mapzen_key)
        if not key:
            raise ValueError('Mapzen requires a [key] as parameter.')

        self.params = {
            'point.lat': location.lat,
            'point.lon': location.lng,
            'size': kwargs.get('size', 1),
            'layers': kwargs.get('layers'),
            'source': kwargs.get('sources'),
            'boundary.country': kwargs.get('country'),
            'api_key': key
        }
        self._initialize(**kwargs)
예제 #16
0
    def __init__(self, location, **kwargs):
        self.url = 'http://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json'
        self.location = str(Location(location))

        # HERE Credentials
        app_id = kwargs.get('app_id', here_app_id)
        app_code = kwargs.get('app_code', here_app_code)
        if not bool(app_id and app_code):
            raise ValueError("Provide app_id & app_code")

        # URL Params
        self.params = {
            'prox': self.location,
            'app_id': app_id,
            'app_code': app_code,
            'mode': 'retrieveAddresses',
            'gen': 8,
        }
        self._initialize(**kwargs)
예제 #17
0
 def _location_init(self, location, **kwargs):
     return {
         'latlng': str(Location(location)),
         'sensor': 'false',
     }
예제 #18
0
 def _get_proximity(self, **kwargs):
     if 'proximity' in kwargs:
         lat, lng = Location(kwargs['proximity']).latlng
         self.params['proximity'] = '{0},{1}'.format(lng, lat)
예제 #19
0
 def lat(self):
     loc = self.parse.get('loc')
     if loc:
         return Location(loc).lat
예제 #20
0
 def _location_init(self, location, **kwargs):
     self.location = str(Location(location))
     self.params['latlng'] = location
     self.params['sensor'] = 'false'
예제 #21
0
def location(location, **kwargs):
    """Parser for different location formats
    """
    return Location(location, **kwargs)
예제 #22
0
 def _build_params(self, location, provider_key, **kwargs):
     return {
         'locations': str(Location(location)),
     }
예제 #23
0
 def _before_initialize(self, location, **kwargs):
     self.url = self.url.format(str(Location(location)))
예제 #24
0
 def _before_initialize(self, location, **kwargs):
     self.location = str(Location(location))
     lat, lng = Location(location).latlng
     self.url = self.url.format(lng=lng, lat=lat)
예제 #25
0
 def _build_params(self, location, provider_key, **kwargs):
     location = Location(location)
     return {
         'query': location,
         'key': provider_key,
     }
예제 #26
0
 def _build_params(self, location, provider_key, **kwargs):
     location = Location(location)
     return {
         'lat': location.lat,
         'lon': location.lng,
     }
예제 #27
0
 def lng(self):
     loc = self.raw.get('loc')
     if loc:
         return Location(loc).lng
예제 #28
0
 def _build_params(self, location, provider_key, **kwargs):
     return {
         'location': str(Location(location)),
         'timestamp': kwargs.get('timestamp', time.time()),
     }