def forward(self, address, types=None, lon=None, lat=None,
                country=None, bbox=None, limit=None, languages=None):
        """Returns a Requests response object that contains a GeoJSON
        collection of places matching the given address.

        `response.geojson()` returns the geocoding result as GeoJSON.
        `response.status_code` returns the HTTP API status code.

        Place results may be constrained to those of one or more types
        or be biased toward a given longitude and latitude.

        See: https://www.mapbox.com/api-documentation/search/#geocoding."""
        uri = URITemplate(self.baseuri + '/{dataset}/{query}.json').expand(
            dataset=self.name, query=address.encode('utf-8'))
        params = {}
        if country:
            params.update(self._validate_country_codes(country))
        if types:
            params.update(self._validate_place_types(types))
        if lon is not None and lat is not None:
            params.update(proximity='{0},{1}'.format(
                round(float(lon), self.precision.get('proximity', 3)),
                round(float(lat), self.precision.get('proximity', 3))))
        if languages:
            params.update(language=','.join(languages))
        if bbox is not None:
            params.update(bbox='{0},{1},{2},{3}'.format(*bbox))
        if limit is not None:
            params.update(limit='{0}'.format(limit))
        resp = self.session.get(uri, params=params)
        self.handle_http_error(resp)

        # for consistency with other services
        def geojson():
            return resp.json()
        resp.geojson = geojson

        return resp
def forward ( self , address , types = None , lon = None , lat = None , country = None , bbox = None , limit = None , languages = None ) : uri = URITemplate ( self . baseuri + '/{dataset}/{query}.json' ) . expand ( dataset = self . name , query = address . encode ( 'utf-8' ) ) params = { } if country : params . update ( self . _validate_country_codes ( country ) ) if types : params . update ( self . _validate_place_types ( types ) ) if lon is not None and lat is not None : params . update ( proximity = '{0},{1}' . format ( round ( float ( lon ) , self . precision . get ( 'proximity' , 3 ) ) , round ( float ( lat ) , self . precision . get ( 'proximity' , 3 ) ) ) ) if languages : params . update ( language = ',' . join ( languages ) ) if bbox is not None : params . update ( bbox = '{0},{1},{2},{3}' . format ( * bbox ) ) if limit is not None : params . update ( limit = '{0}' . format ( limit ) ) resp = self . session . get ( uri , params = params ) self . handle_http_error ( resp ) def geojson ( ) : return resp . json ( ) resp . geojson = geojson return resp
Returns a Requests response object that contains a GeoJSON
        collection of places matching the given address.

        `response.geojson()` returns the geocoding result as GeoJSON.
        `response.status_code` returns the HTTP API status code.

        Place results may be constrained to those of one or more types
        or be biased toward a given longitude and latitude.

        See: https://www.mapbox.com/api-documentation/search/#geocoding.