Beispiel #1
0
def flask_to_geojson(source: MapSource):

    if not source.is_loaded:
        source.load()

    resp = render_geojson(source)
    return resp
Beispiel #2
0
def get_geojson(request, source: MapSource):

    if not source.is_loaded:
        source.load()

    response = render_geojson(source)
    return JsonResponse(response, safe=False)
Beispiel #3
0
def get_tile(request, source: MapSource, z=0, x=0, y=0):
    if not source.is_loaded:
        print(f'Dynamically Loading Data {source.name}', file=sys.stdout)
        source.load()

    img = render_map(source, x=int(x), y=int(y), z=int(z))
    return StreamingHttpResponse(img.to_bytesio(), content_type='image/png')
Beispiel #4
0
def flask_to_tile(source: MapSource, z=0, x=0, y=0):

    if not source.is_loaded:
        print(f'Dynamically Loading Data {source.name}', file=sys.stdout)
        source.load()

    img = render_map(source, x=int(x), y=int(y), z=int(z))
    return send_file(img.to_bytesio(), mimetype='image/png')
Beispiel #5
0
def get_image(request, source: MapSource,
              xmin=-20e6, ymin=-20e6,
              xmax=20e6, ymax=20e6,
              height=500, width=500):
    if not source.is_loaded:
        source.load()

    img = render_map(source, xmin=float(xmin), ymin=float(ymin),
                     xmax=float(xmax), ymax=float(ymax),
                     height=int(height), width=int(width))
    return StreamingHttpResponse(img.to_bytesio(), content_type='image/png')
Beispiel #6
0
def flask_to_image(source: MapSource,
                   xmin=-20e6, ymin=-20e6,
                   xmax=20e6, ymax=20e6,
                   height=500, width=500):

    if not source.is_loaded:
        source.load()

    img = render_map(source, xmin=float(xmin), ymin=float(ymin),
                     xmax=float(xmax), ymax=float(ymax),
                     height=int(height), width=int(width))
    return send_file(img.to_bytesio(), mimetype='image/png')
Beispiel #7
0
def flask_to_wms(source: MapSource):

    if not source.is_loaded:
        source.load()

    height = request.args.get('height')
    width = request.args.get('width')
    bbox = request.args.get('bbox')
    xmin, ymin, xmax, ymax = bbox.split(',')
    img = render_map(source, xmin=float(xmin), ymin=float(ymin),
                     xmax=float(xmax), ymax=float(ymax),
                     height=int(height), width=int(width))
    return send_file(img.to_bytesio(), mimetype='image/png')
Beispiel #8
0
def get_wms(request, source: MapSource):

    if not source.is_loaded:
        source.load()

    height = request.GET.get('height')
    width = request.GET.get('width')
    bbox = request.GET.get('bbox', '')
    xmin, ymin, xmax, ymax = bbox.split(',')
    img = render_map(source, xmin=float(xmin), ymin=float(ymin),
                     xmax=float(xmax), ymax=float(ymax),
                     height=int(height), width=int(width))
    return StreamingHttpResponse(img.to_bytesio(), content_type='image/png')
Beispiel #9
0
def flask_to_geojson(source: MapSource):

    if not source.is_loaded:
        source.load()

    q = request.args.get('q')
    limit = request.args.get('limit')
    offset = request.args.get('offset')
    simplify = request.args.get('simplify')
    bbox = request.args.get('bbox')


    resp = render_geojson(source)
    return resp