aboutsummaryrefslogtreecommitdiff
path: root/src/shop_map_node5_net.py
blob: 5154a0d97ea5b05bb490698d50fb2d5bee9fb0c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json

import flask

import db_handler


app = flask.Flask(__name__, template_folder='templates', static_folder='static', static_url_path='')


@app.route("/")
def index():
    return flask.redirect('/index.html')


@app.route("/supermarkets.json")
def supermarkets():
    return db_handler.get_supermarkets()


@app.route("/voronoi_polygons.json")
def voronoi_polygons():
    d = db_handler.voronoi_polygons()
    b = []
    for a in json.loads(d)['geometries']:
        c = []
        for g in a['coordinates'][0]:
            c.append([g[1], g[0]])
        b.append(c)
    return json.dumps(b)