def get_tile_url(self, x, y, z, layer_id=None, feature_id=None,
                     filter=None, extension="png"):
        """
        Prepares a URL to get data (raster or vector) from a NamedMap or
        AnonymousMap

        :param x: The x tile
        :param y: The y tile
        :param z: The zoom level
        :param layer_id: Can be a number (referring to the # layer of your  \
                        map), all layers of your map, or a list of layers.
                        To show just the basemap layer, enter the value 0
                        To show the first layer, enter the value 1
                        To show all layers, enter the value 'all'
                        To show a list of layers, enter the comma separated \
                        layer value as '0,1,2'
        :param feature_id: The id of the feature
        :param filter: The filter to be applied to the layer
        :param extension: The format of the data to be retrieved: png, mvt, ...
        :type x: int
        :type y: int
        :type z: int
        :type layer_id: str
        :type feature_id: str
        :type filter: str
        :type extension: str

        :return: A URL to download data
        :rtype: str

        :raise: CartoException
        """
        base_url = self.client.base_url + self.Meta.collection_endpoint
        template_id = self.template_id if hasattr(self, 'template_id') \
            else self.layergroupid
        if layer_id is not None and feature_id is not None:
            url = urljoin(base_url,
                          "{template_id}/{layer}/attributes/{feature_id}"). \
                          format(template_id=template_id,
                                 layer=layer_id,
                                 feature_id=feature_id)
        elif layer_id is not None and filter is not None:
            url = urljoin(base_url,
                          "{template_id}/{filter}/{z}/{x}/{y}.{extension}"). \
                          format(template_id=template_id,
                                 filter=filter,
                                 z=z, x=x, y=y,
                                 extension=extension)
        elif layer_id is not None:
            url = urljoin(base_url,
                          "{template_id}/{layer}/{z}/{x}/{y}.{extension}"). \
                          format(template_id=template_id,
                                 layer=layer_id,
                                 z=z, x=x, y=y,
                                 extension=extension)
        else:
            url = urljoin(base_url, "{template_id}/{z}/{x}/{y}.{extension}"). \
                          format(
                               template_id=template_id,
                               z=z, x=x, y=y,
                               extension=extension)

        if hasattr(self, 'auth') and self.auth is not None \
           and len(self.auth['valid_tokens']) > 0:
            url = urljoin(url, "?auth_token={auth_token}"). \
                format(auth_token=self.auth['valid_tokens'][0])

        return url
Prepares a URL to get data (raster or vector) from a NamedMap or
        AnonymousMap

        :param x: The x tile
        :param y: The y tile
        :param z: The zoom level
        :param layer_id: Can be a number (referring to the # layer of your  \
                        map), all layers of your map, or a list of layers.
                        To show just the basemap layer, enter the value 0
                        To show the first layer, enter the value 1
                        To show all layers, enter the value 'all'
                        To show a list of layers, enter the comma separated \
                        layer value as '0,1,2'
        :param feature_id: The id of the feature
        :param filter: The filter to be applied to the layer
        :param extension: The format of the data to be retrieved: png, mvt, ...
        :type x: int
        :type y: int
        :type z: int
        :type layer_id: str
        :type feature_id: str
        :type filter: str
        :type extension: str

        :return: A URL to download data
        :rtype: str

        :raise: CartoException