Create building-per-geometry

This commit is contained in:
Tom Russell 2018-09-09 11:32:27 +01:00
parent 3711fc5f80
commit 54633d9e04

View File

@ -5,6 +5,11 @@
doc: {source_id: <toid>},
geom: <geom-wkb_hex>
}
- create corresponding 'building' record with {
id: <building-guid>,
doc: {},
geom_id: <polygon-guid>
}
"""
import glob
import json
@ -55,6 +60,7 @@ def save_feature(cur, feature):
%s::jsonb,
ST_SetSRID(%s::geometry, %s)
)
RETURNING geometry_id
""", (
json.dumps({
'source_id': feature['properties']['fid']
@ -63,6 +69,23 @@ def save_feature(cur, feature):
3857
)
)
geom_id, = cur.fetchone()
cur.execute(
"""INSERT INTO buildings
(
building_doc,
geometry_id
)
VALUES
(
%s::jsonb,
%s
)
""", (
json.dumps({}),
geom_id
)
)
def read_config(config_path):