Refine
This commit is contained in:
@@ -58,16 +58,19 @@ def get_pipe_risk_probability_geometries(name: str) -> dict[str, Any]:
|
||||
pipe_risk_probability_geometries = {}
|
||||
|
||||
key_pipeId = '编码'
|
||||
key_startnode = '上游节点'
|
||||
key_endnode = '下游节点'
|
||||
# key_startnode = '上游节点'
|
||||
# key_endnode = '下游节点'
|
||||
key_geometry = 'geometry'
|
||||
|
||||
with conn[name].cursor(row_factory=dict_row) as cur:
|
||||
cur.execute(f"select {key_pipeId}, {key_startnode}, {key_endnode}, ST_AsGeoJSON(geometry) AS {key_geometry} from gis_pipe")
|
||||
cur.execute(f"select {key_pipeId}, ST_AsGeoJSON(geometry) AS {key_geometry} from gis_pipe")
|
||||
for record in cur:
|
||||
print(record[key_pipeId])
|
||||
print(record[key_startnode])
|
||||
print(record[key_endnode])
|
||||
print(record[key_geometry])
|
||||
id = record[key_pipeId]
|
||||
geom = record[key_geometry]
|
||||
|
||||
pipe_risk_probability_geometries[id] = {
|
||||
'start': geom['coordinates'][0],
|
||||
'end': geom['coordinates'][1]
|
||||
}
|
||||
|
||||
return pipe_risk_probability_geometries
|
||||
Reference in New Issue
Block a user