submarcos/django-vectortiles

Manage Meta View to serve many vector tiles and generated tilejson at once

submarcos opened this issue · 0 comments

ex:

class MetaMVTView(View):
    content_type = "application/x-protobuf"
    vector_layers = (MVTView1, MVTView2)

    def get_vector_layers():
        return self.vector_layers

    def get(request, z, x, y):
        content = b''
        for layer in self.get_vector_layers():
            content += layer.get_tile(z, x, y)
        return HTTPResponse(content, content_type=self.content_type)


class TileJSONView(View):
    vector_layers = (MVTView1, MVTView2)

    def get_vector_layers():
        return self.vector_layers

    def get_tilejson():
        return {xxxx}

    def get(request, *args, **kwargs):
        return JSONResponse(self.get_tilejson())