You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I want to calculate route and show the result on map in MAUI App. So I need to calculate the route fast even on mobile phone. To achieve this, firstly I run my app on PC, which:
loads data from osm.pbf file
adds contracted graph for profile Vehicle.Car.Fastest()
serialize the routerdb to file on PC
This is the code:
var routerDb = new RouterDb();
var input = new FileInfo(@"C:\Users\zdene\Downloads\czech-republic-latest.osm.pbf").OpenRead();
routerDb.LoadOsmData(input, Vehicle.Car);
routerDb.AddContracted(Vehicle.Car.Fastest());
using (var output = new FileInfo(@"C:\Users\zdene\Downloads\czech-republic-cartest.routerdb").Open(FileMode.Create))
{
routerDb.Serialize(output);
}
Then I take the generated file, transfer it to my mobile phone's documents and serialize it to AppDataDirectory of MAUI App
This is the code:
var routerDb = new RouterDb();
var result = await FilePicker.Default.PickAsync();
using var stream = await result.OpenReadAsync();
routerDb = RouterDb.Deserialize(stream);
string localGdbFilePath = Path.Combine(FileSystem.Current.AppDataDirectory, "czech-republic.routerdb");
routerDb.Serialize(File.Create(localGdbFilePath));
router = new Router(routerDb);
Then when running app, I use this code to load routerdb from AppDataDirectory: router = new Router(RouterDb.Deserialize(File.OpenRead(localGdbFilePath), RouterDbProfile.NoCache));
When I try to calculate route from the same file on PC, it works perfectly and fast, but when I try the same task for the same coordinates from the same file on mobile, it fails with error:
No edge found from 576420 to 0.
I tried a lot of variants to solve this, but nothing works. Also, calculating the route on mobile without previously adding contracted graph to the file works correctly, but takes too long when calculating slightly longer distances. So I need to make it faster.
I don't know where is the problem or what I am doing wrong.
I would appreciate any advice. I hope someone could help me.
The text was updated successfully, but these errors were encountered:
Hello, I want to calculate route and show the result on map in MAUI App. So I need to calculate the route fast even on mobile phone. To achieve this, firstly I run my app on PC, which:
This is the code:
Then I take the generated file, transfer it to my mobile phone's documents and serialize it to AppDataDirectory of MAUI App
This is the code:
Then when running app, I use this code to load routerdb from AppDataDirectory:
router = new Router(RouterDb.Deserialize(File.OpenRead(localGdbFilePath), RouterDbProfile.NoCache));
When I try to calculate route from the same file on PC, it works perfectly and fast, but when I try the same task for the same coordinates from the same file on mobile, it fails with error:
I tried a lot of variants to solve this, but nothing works. Also, calculating the route on mobile without previously adding contracted graph to the file works correctly, but takes too long when calculating slightly longer distances. So I need to make it faster.
I don't know where is the problem or what I am doing wrong.
I would appreciate any advice. I hope someone could help me.
The text was updated successfully, but these errors were encountered: