From 9c53c677639563bc4211e351a978892321cf4960 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 6 Apr 2023 14:33:00 +0200 Subject: [PATCH] Added /getClosestNode lat lon API --- API/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/API/Program.cs b/API/Program.cs index be3804a..0437483 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -1,4 +1,5 @@ using OSMDatastructure.Graph; +using OSMImporter; using Pathfinding; var builder = WebApplication.CreateBuilder(args); @@ -22,6 +23,12 @@ app.MapGet("/getRoute", (float latStart, float lonStart, float latEnd, float lon } ); +app.MapGet("/getClosestNode", (float lat, float lon) => +{ + RegionManager regionManager = new RegionManager("D:/stuttgart-regbez-latest"); + return Pathfinder.ClosestNodeToCoordinates(new Coordinates(lat, lon), Tag.SpeedType.car, ref regionManager); +}); + // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) {