Create building-per-geometry
This commit is contained in:
parent
3711fc5f80
commit
54633d9e04
@ -5,6 +5,11 @@
|
|||||||
doc: {source_id: <toid>},
|
doc: {source_id: <toid>},
|
||||||
geom: <geom-wkb_hex>
|
geom: <geom-wkb_hex>
|
||||||
}
|
}
|
||||||
|
- create corresponding 'building' record with {
|
||||||
|
id: <building-guid>,
|
||||||
|
doc: {},
|
||||||
|
geom_id: <polygon-guid>
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
@ -55,6 +60,7 @@ def save_feature(cur, feature):
|
|||||||
%s::jsonb,
|
%s::jsonb,
|
||||||
ST_SetSRID(%s::geometry, %s)
|
ST_SetSRID(%s::geometry, %s)
|
||||||
)
|
)
|
||||||
|
RETURNING geometry_id
|
||||||
""", (
|
""", (
|
||||||
json.dumps({
|
json.dumps({
|
||||||
'source_id': feature['properties']['fid']
|
'source_id': feature['properties']['fid']
|
||||||
@ -63,6 +69,23 @@ def save_feature(cur, feature):
|
|||||||
3857
|
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):
|
def read_config(config_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user