This commit is contained in:
DingZQ
2025-04-19 12:24:08 +08:00
parent 2f8e1f1fc7
commit b085e4b4de

View File

@@ -57,12 +57,17 @@ def get_pipes_risk_probability(name: str, pipe_ids: list[str]) -> list[dict[str,
def get_pipe_risk_probability_geometries(name: str) -> dict[str, Any]:
pipe_risk_probability_geometries = {}
key_pipeId = '编码'
key_startnode = '上游节点'
key_endnode = '下游节点'
key_geometry = 'geometry'
with conn[name].cursor(row_factory=dict_row) as cur:
cur.execute(f"select '编码' AS Id, '上游节点' AS startnode, '下游节点' AS endnode, ST_AsGeoJSON(geometry) AS geometry from gis_pipe")
cur.execute(f"select {key_pipeId}, {key_startnode}, {key_endnode}, ST_AsGeoJSON(geometry) AS {key_geometry} from gis_pipe")
for record in cur:
print(record['Id'])
print(record['startnode'])
print(record['endnode'])
print(record['geometry'])
print(record[key_pipeId])
print(record[key_startnode])
print(record[key_endnode])
print(record[key_geometry])
return pipe_risk_probability_geometries