Added /getClosestNode lat lon API

This commit is contained in:
glax 2023-04-06 14:33:00 +02:00
parent f266c6c7e6
commit 9c53c67763

View File

@ -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())
{