Return type from getnetworkcoord
This commit is contained in:
4
main.py
4
main.py
@@ -1393,12 +1393,14 @@ async def fastapi_get_node_coord(network: str, node: str) -> dict[str, float] |
|
||||
return get_node_coord(network, node)
|
||||
|
||||
# DingZQ, 2024-12-08, get all node coord
|
||||
# id:type:x:y
|
||||
# type: junction, reservoir, tank
|
||||
@app.get("/getnetworkcoords/")
|
||||
async def fastapi_get_network_coords(network: str) -> list[str] | None:
|
||||
coords = get_network_coords(network)
|
||||
result = []
|
||||
for node_id, coord in coords.items():
|
||||
result.append(f"{node_id}:{coord['x']}:{coord['y']}")
|
||||
result.append(f"{node_id}:{coord['type']}:{coord['x']}:{coord['y']}")
|
||||
return result
|
||||
|
||||
# DingZQ, 2024-12-08, get all links' start and end node
|
||||
|
||||
Reference in New Issue
Block a user