Add API to get all node properties
This commit is contained in:
@@ -24,6 +24,23 @@ def get_junction(name: str, id: str) -> dict[str, Any]:
|
||||
d['links'] = get_node_links(name, id)
|
||||
return d
|
||||
|
||||
# DingZQ, 2025-03-29
|
||||
def get_all_junctions(name: str) -> list[dict[str, Any]]:
|
||||
rows = read_all(name, f"select * from junctions")
|
||||
if rows == None:
|
||||
return []
|
||||
|
||||
result = []
|
||||
for row in rows:
|
||||
d = {}
|
||||
d['id'] = str(row['id'])
|
||||
d['x'] = float(row['x'])
|
||||
d['y'] = float(row['y'])
|
||||
d['elevation'] = float(row['elevation'])
|
||||
d['links'] = get_node_links(name, row['id'])
|
||||
result.append(d)
|
||||
|
||||
return result
|
||||
|
||||
class Junction(object):
|
||||
def __init__(self, input: dict[str, Any]) -> None:
|
||||
|
||||
Reference in New Issue
Block a user