feat(graph): fix

This commit is contained in:
vl.arkhangelskii
2026-09-21 13:21:38 +03:00
parent b8d611beee
commit 236c0bc754
10 changed files with 637 additions and 396 deletions
@@ -18,6 +18,10 @@ public sealed record RoadGraphEdge(
string Highway,
string? Name,
bool Oneway,
double LengthM);
double LengthM,
double FromLon,
double FromLat,
double ToLon,
double ToLat);
public sealed record RoadGraphPage<T>(IReadOnlyList<T> Items, long? NextAfter);
@@ -129,7 +129,8 @@ public sealed class SqliteRoadGraphStore(IDataPaths paths, ILogger<SqliteRoadGra
// Edge is in bbox if either endpoint is inside (cheap join, good enough for light API).
command.CommandText =
"""
SELECT e.id, e.from_id, e.to_id, e.highway, e.name, e.oneway, e.length_m
SELECT e.id, e.from_id, e.to_id, e.highway, e.name, e.oneway, e.length_m,
a.lon, a.lat, b.lon, b.lat
FROM edges e
INNER JOIN nodes a ON a.id = e.from_id
INNER JOIN nodes b ON b.id = e.to_id
@@ -167,7 +168,11 @@ public sealed class SqliteRoadGraphStore(IDataPaths paths, ILogger<SqliteRoadGra
reader.GetString(3),
reader.IsDBNull(4) ? null : reader.GetString(4),
reader.GetInt64(5) != 0,
reader.GetDouble(6)));
reader.GetDouble(6),
reader.GetDouble(7),
reader.GetDouble(8),
reader.GetDouble(9),
reader.GetDouble(10)));
}
return new RoadGraphPage<RoadGraphEdge>(items, next);