Пример #1
0
def seed_layer(request, layer):
    mnz = int(request.GET['minz'])
    mxz = int(request.GET['maxz']) # anything greater would cause a DOS attack.  We should do it manually
    mnx = int(request.GET['minx'])
    mxx = int(request.GET['maxx'])
    mny = int(request.GET['miny'])
    mxy = int(request.GET['maxy'])

    layer = RenderedLayer.objects.get(slug=layer)
    style = request.GET.get('style', layer.default_style)

    user = authorize(request, page=layer, edit=True)
    dispatch.api_accessed.send(RenderedLayer, instance=layer, user=user)
    CacheManager.get().get_tile_cache(layers=[layer], styles=[style]).seed_tiles(mnz, mxz, mnx, mny, mxx, mxy)
    return HttpResponse()
Пример #2
0
def seed_layer(request, layer):
    mnz = int(request.GET['minz'])
    mxz = int(
        request.GET['maxz']
    )  # anything greater would cause a DOS attack.  We should do it manually
    mnx = int(request.GET['minx'])
    mxx = int(request.GET['maxx'])
    mny = int(request.GET['miny'])
    mxy = int(request.GET['maxy'])

    layer = RenderedLayer.objects.get(slug=layer)
    style = request.GET.get('style', layer.default_style)

    user = authorize(request, page=layer, edit=True)
    dispatch.api_accessed.send(RenderedLayer, instance=layer, user=user)
    CacheManager.get().get_tile_cache(layers=[layer],
                                      styles=[style]).seed_tiles(
                                          mnz, mxz, mnx, mny, mxx, mxy)
    return HttpResponse()
Пример #3
0
def tms(request, layer, z, x, y, **kwargs):
    z = int(z)
    x = int(x)
    y = int(y)

    table = None
    if '#' in layer:
        layer_slug, table = layer.split('#')
    else:
        layer_slug = layer
    layer_instance = RenderedLayer.objects.get(slug=layer_slug)

    user = authorize(request, page=layer, view=True)
    dispatch.api_accessed.send(RenderedLayer, instance=layer_instance, user=user)
    style = request.GET.get('styles', layer_instance.default_style.slug)
    tms = CacheManager.get().get_tile_cache([layer], [style])
    return HttpResponse(tms.fetch_tile(z, x, y), mimetype='image/png')
Пример #4
0
def tms(request, layer, z, x, y, **kwargs):
    z = int(z)
    x = int(x)
    y = int(y)

    table = None
    if '#' in layer:
        layer_slug, table = layer.split('#')
    else:
        layer_slug = layer
    layer_instance = RenderedLayer.objects.get(slug=layer_slug)

    # dispatch.api_accessed.send(RenderedLayer, instance=layer_instance, user=user)
    style = request.GET.get('style', layer_instance.default_style.slug)
    tms = CacheManager.get().get_tile_cache([layer], [style])
    try:
       return HttpResponse(tms.fetch_tile(z, x, y), mimetype='image/png')
    except Exception, e:
       return HttpResponse(str(e), mimetype='text/plain')
Пример #5
0
def tms(request, layer, z, x, y, **kwargs):
    z = int(z)
    x = int(x)
    y = int(y)

    table = None
    if '#' in layer:
        layer_slug, table = layer.split('#')
    else:
        layer_slug = layer
    layer_instance = RenderedLayer.objects.get(slug=layer_slug)

    user = authorize(request, page=layer, view=True)
    dispatch.api_accessed.send(RenderedLayer,
                               instance=layer_instance,
                               user=user)
    style = request.GET.get('styles', layer_instance.default_style.slug)
    tms = CacheManager.get().get_tile_cache([layer], [style])
    return HttpResponse(tms.fetch_tile(z, x, y), mimetype='image/png')