12 lines
373 B
Python
12 lines
373 B
Python
from .operation import read
|
|
|
|
|
|
def _to_client_point(coord: str) -> dict[str, float]:
|
|
xy = coord.removeprefix('(').removesuffix(')').split(',')
|
|
return { 'x': float(xy[0]), 'y': float(xy[1]) }
|
|
|
|
|
|
def get_node_coord(name: str, id: str) -> dict[str, float]:
|
|
row = read(name, f"select * from coordinates where node = '{id}'")
|
|
return _to_client_point(row['coord'])
|