minimal formatting for featurecollections
This commit is contained in:
parent
1f6cc66b36
commit
3f2c5d9429
1 changed files with 8 additions and 2 deletions
10
backend.py
10
backend.py
|
@ -47,7 +47,10 @@ SELECT format('{"type":"Feature", "id": "'|| events_id::text ||'", "properties":
|
||||||
FROM events
|
FROM events
|
||||||
JOIN geo ON (hash=events_geo)""");
|
JOIN geo ON (hash=events_geo)""");
|
||||||
standard_headers(resp)
|
standard_headers(resp)
|
||||||
resp.body = '{"type": "FeatureCollection","features": ['+','.join([x[0] for x in cur.fetchall()])+']}'
|
resp.body = """{"type": "FeatureCollection","features": [
|
||||||
|
"""+""",
|
||||||
|
""".join([x[0] for x in cur.fetchall()])+"""
|
||||||
|
]}"""
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
|
|
||||||
class EventResource(object):
|
class EventResource(object):
|
||||||
|
@ -108,7 +111,10 @@ SELECT '{"type":"Feature", "properties": '|| (events_tags::jsonb || jsonb_build_
|
||||||
ORDER BY createdate DESC
|
ORDER BY createdate DESC
|
||||||
LIMIT 50;
|
LIMIT 50;
|
||||||
""")
|
""")
|
||||||
resp.body = '{"type": "FeatureCollection","features": ['+','.join([x[0] for x in cur.fetchall()])+']}'
|
resp.body = """{"type":"FeatureCollection", "features": [
|
||||||
|
"""+""",
|
||||||
|
""".join([x[0] for x in cur.fetchall()])+"""
|
||||||
|
]}"""
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
else:
|
else:
|
||||||
# get single event geojson Feature by id
|
# get single event geojson Feature by id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue