Request directions for waypoints encoded as GeoJSON features.

        Parameters
        ----------
        features : iterable
            An collection of GeoJSON features
        profile : str
            Name of a Mapbox profile such as 'mapbox.driving'
        alternatives : bool
            Whether to try to return alternative routes, default: False
        geometries : string
            Type of geometry returned (geojson, polyline, polyline6)
        overview : string or False
            Type of returned overview geometry: 'full', 'simplified',
            or False
        steps : bool
            Whether to return steps and turn-by-turn instructions,
            default: False
        continue_straight : bool
            Direction of travel when departing intermediate waypoints
        radiuses : iterable of numbers or 'unlimited'
            Must be same length as features
        waypoint_snapping : list
            Controls snapping of waypoints

            The list is zipped with the features collection and must
            have the same length. Elements of the list must be one of:

            - A number (interpretted as a snapping radius)
            - The string 'unlimited' (unlimited snapping radius)
            - A 3-element tuple consisting of (radius, angle, range)
            - None (no snapping parameters specified for that waypoint)
        annotations : str
            Whether or not to return additional metadata along the route

            Possible values are: 'duration', 'distance', 'speed', and
            'congestion'. Several annotations can be used by joining
            them with ','.
        language : str
            Language of returned turn-by-turn text instructions,
            default: 'en'

        Returns
        -------
        requests.Response
            The response object has a geojson() method for access to
            the route(s) as a GeoJSON-like FeatureCollection
            dictionary.

def directions(self, features, profile='mapbox/driving',
                   alternatives=None, geometries=None, overview=None, steps=None,
                   continue_straight=None, waypoint_snapping=None, annotations=None,
                   language=None, **kwargs):
        """Request directions for waypoints encoded as GeoJSON features.

        Parameters
        ----------
        features : iterable
            An collection of GeoJSON features
        profile : str
            Name of a Mapbox profile such as 'mapbox.driving'
        alternatives : bool
            Whether to try to return alternative routes, default: False
        geometries : string
            Type of geometry returned (geojson, polyline, polyline6)
        overview : string or False
            Type of returned overview geometry: 'full', 'simplified',
            or False
        steps : bool
            Whether to return steps and turn-by-turn instructions,
            default: False
        continue_straight : bool
            Direction of travel when departing intermediate waypoints
        radiuses : iterable of numbers or 'unlimited'
            Must be same length as features
        waypoint_snapping : list
            Controls snapping of waypoints

            The list is zipped with the features collection and must
            have the same length. Elements of the list must be one of:

            - A number (interpretted as a snapping radius)
            - The string 'unlimited' (unlimited snapping radius)
            - A 3-element tuple consisting of (radius, angle, range)
            - None (no snapping parameters specified for that waypoint)
        annotations : str
            Whether or not to return additional metadata along the route

            Possible values are: 'duration', 'distance', 'speed', and
            'congestion'. Several annotations can be used by joining
            them with ','.
        language : str
            Language of returned turn-by-turn text instructions,
            default: 'en'

        Returns
        -------
        requests.Response
            The response object has a geojson() method for access to
            the route(s) as a GeoJSON-like FeatureCollection
            dictionary.
        """
        # backwards compatible, deprecated
        if 'geometry' in kwargs and geometries is None:
            geometries = kwargs['geometry']
            warnings.warn('Use `geometries` instead of `geometry`',
                          errors.MapboxDeprecationWarning)

        annotations = self._validate_annotations(annotations)
        coordinates = encode_coordinates(
            features, precision=6, min_limit=2, max_limit=25)
        geometries = self._validate_geom_encoding(geometries)
        overview = self._validate_geom_overview(overview)
        profile = self._validate_profile(profile)

        bearings, radii = self._validate_snapping(waypoint_snapping, features)

        params = {}
        if alternatives is not None:
            params.update(
                {'alternatives': 'true' if alternatives is True else 'false'})
        if geometries is not None:
            params.update({'geometries': geometries})
        if overview is not None:
            params.update(
                {'overview': 'false' if overview is False else overview})
        if steps is not None:
            params.update(
                {'steps': 'true' if steps is True else 'false'})
        if continue_straight is not None:
            params.update(
                {'continue_straight': 'true' if steps is True else 'false'})
        if annotations is not None:
            params.update({'annotations': ','.join(annotations)})
        if language is not None:
            params.update({'language': language})
        if radii is not None:
            params.update(
                {'radiuses': ';'.join(str(r) for r in radii)})
        if bearings is not None:
            params.update(
                {'bearings': ';'.join(self._encode_bearing(b) for b in bearings)})

        profile_ns, profile_name = profile.split('/')

        uri = URITemplate(
            self.baseuri + '/{profile_ns}/{profile_name}/{coordinates}.json').expand(
                profile_ns=profile_ns, profile_name=profile_name, coordinates=coordinates)

        resp = self.session.get(uri, params=params)
        self.handle_http_error(resp)

        def geojson():
            return self._geojson(resp.json(), geom_format=geometries)
        resp.geojson = geojson
        return resp