Exemplo n.º 1
0
def animation_value(request):
    presentationlayer_id = request.GET.get('presentationlayer_id')
    framenr = request.GET.get('framenr')
    x = request.GET.get('lon')  # In Google
    y = request.GET.get('lat')

    if None in (presentationlayer_id, framenr, x, y):
        raise Http404()

    try:
        framenr = int(framenr)
    except ValueError:
        raise Http404()

    result, presentation_layer = get_result_by_presentationlayer_id(
        presentationlayer_id, return_layer=True)
    unit = presentation_layer.presentationtype.unit

    animation = result.animation

    if animation is None:
        return JSONResponse({})

    if not (0 <= int(framenr) < animation.frames):
        raise Http404()

    rd_x, rd_y = geo.google_to_rd(x, y)

    value = point_from_dataset(animation, framenr, (rd_x, rd_y))

    if value >= LIMIT:
        return JSONResponse({'value': value, 'unit': unit})
    else:
        return JSONResponse({})
Exemplo n.º 2
0
def animation_value(request):
    presentationlayer_id = request.GET.get('presentationlayer_id')
    framenr = request.GET.get('framenr')
    x = request.GET.get('lon')  # In Google
    y = request.GET.get('lat')

    if None in (presentationlayer_id, framenr, x, y):
        raise Http404()

    try:
        framenr = int(framenr)
    except ValueError:
        raise Http404()

    result, presentation_layer = get_result_by_presentationlayer_id(
        presentationlayer_id, return_layer=True)
    unit = presentation_layer.presentationtype.unit

    animation = result.animation

    if animation is None:
        return JSONResponse({})

    if not (0 <= int(framenr) < animation.frames):
        raise Http404()

    rd_x, rd_y = geo.google_to_rd(x, y)

    value = point_from_dataset(animation, framenr, (rd_x, rd_y))

    if value >= LIMIT:
        return JSONResponse({'value': value, 'unit': unit})
    else:
        return JSONResponse({})
Exemplo n.º 3
0
def pyramid_value(request):
    """Get value in pyramid at some lat/lon coordinate."""
    presentationlayer_id = request.GET.get('presentationlayer_id')
    x = request.GET.get('lon')  # In Google
    y = request.GET.get('lat')

    rd_x, rd_y = geo.google_to_rd(x, y)

    result, presentation_layer = get_result_by_presentationlayer_id(
        presentationlayer_id, return_layer=True)
    unit = presentation_layer.presentationtype.unit

    pyramid = result.raster.pyramid

    value = pyramid.fetch_single_point(rd_x, rd_y)[0]

    if value is not None and value >= LIMIT:
        return JSONResponse({'value': value, 'unit': unit or ""})
    else:
        return JSONResponse({})
Exemplo n.º 4
0
def pyramid_value(request):
    """Get value in pyramid at some lat/lon coordinate."""
    presentationlayer_id = request.GET.get('presentationlayer_id')
    x = request.GET.get('lon')  # In Google
    y = request.GET.get('lat')

    rd_x, rd_y = geo.google_to_rd(x, y)

    result, presentation_layer = get_result_by_presentationlayer_id(
        presentationlayer_id, return_layer=True)
    unit = presentation_layer.presentationtype.unit

    pyramid = result.raster.pyramid

    value = pyramid.fetch_single_point(rd_x, rd_y)[0]

    if value is not None and value >= LIMIT:
        return JSONResponse({
                'value': value,
                'unit': unit or ""
                })
    else:
        return JSONResponse({})