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
{{ message }}
Repository navigation
Loading routing information from a read only file system. #217
Hello, I was having trouble loading the routing information from an obb file because the file system created when i mounted the obb was an read only file system. I was using the following code:
GraphHopper tmpHoppFOOT = new GraphHopper().forMobile();
tmpHoppFOOT.setCHShortcuts("fastest");
tmpHoppFOOT.setEncodingManager(new EncodingManager("FOOT"));
tmpHoppFOOT.load(mapsFolder + currentAreaFOOT);
and getting the following error:
The load causes the following error message: AndroidRuntime(3498): Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /mnt/obb/07f4c5780b38b1ae526b333f8087a627/FootPortugal-gh/edges (Read-only file system)
The problem was graphhopper opened the map files as read/write. I changed the following lines in MMapDataAccess:
line 68:
from:
raFile = new RandomAccessFile(getFullName(), "rw");
to
raFile = new RandomAccessFile(getFullName(), "r");
line 176:
from:
buf = raFile.getChannel().map(FileChannel.MapMode.READ_WRITE, offset, byteCount);
to:
buf = raFile.getChannel().map(FileChannel.MapMode.READ_ONLY, offset, byteCount);
With this changes I was able to successfully load the map and routing information from the obb file system.
Thanks! Maybe you have time to create a pull request which makes this configurable? Of course we shouldn't use this as default but on systems like Android we can and should do it.
I have tried the new GH version but it does not work on mounted shared folders, I still receive messages like: Couldn't map buffer 0 of 2 at position 100 for 2097052 bytes with offset 100, new file Length:2097252
Hmmh, does it really work in every area? Shared folders is probably not really possible for memory mapping? (But for small areas you could easily switch to RAM_STORE, should be also a lot faster for the queries but requires more RAM)
The thing is I want to avoid moving all the time the graphs to the Android emulators / devices, as I change them frequently with various tests.
I have to rebuild now all my graphs (Version of edges unsupported: 7, expected:9), but initial tests seem to work. I'll report any unfortunate results.
Ok with the graphHopper.setAllowWrites(false) I have no warnings and all seem to work.
Using your snippet the previous warnings were like: Couldn't map buffer 0 of 2 at position 100 for 2097052 bytes with offset 100, new file Length:2097252, file:/mnt/shared/graphs/cyprus-gh/nodes
Activity
karussell commentedon Jun 11, 2014
Thanks! Maybe you have time to create a pull request which makes this configurable? Of course we shouldn't use this as default but on systems like Android we can and should do it.
karussell commentedon Jun 23, 2014
This here should use the new variable introduced in #112:
graphHopper.setAllowWrites(false)devemux86 commentedon Nov 7, 2014
That's probably related to my post here.
I have tried the new GH version but it does not work on mounted shared folders, I still receive messages like:
Couldn't map buffer 0 of 2 at position 100 for 2097052 bytes with offset 100, new file Length:2097252Emux
Cruiser - Atlas
devemux86 commentedon Nov 7, 2014
I spoke too soon, even with the warnings now the routing is working!
Emux
Cruiser - Atlas
karussell commentedon Nov 7, 2014
Hmmh, does it really work in every area? Shared folders is probably not really possible for memory mapping? (But for small areas you could easily switch to RAM_STORE, should be also a lot faster for the queries but requires more RAM)
devemux86 commentedon Nov 7, 2014
The thing is I want to avoid moving all the time the graphs to the Android emulators / devices, as I change them frequently with various tests.
I have to rebuild now all my graphs (
Version of edges unsupported: 7, expected:9), but initial tests seem to work. I'll report any unfortunate results.Emux
Cruiser - Atlas
karussell commentedon Nov 7, 2014
The error looks bad - would you mind to add the getFullName to the exception in MMapDataAccess?
Maybe we need some additional escaping or something ...
Yes, sorry for the inconvenience. See here #281 for hopefully less recreation work in the future.
devemux86 commentedon Nov 7, 2014
Ok with the
graphHopper.setAllowWrites(false)I have no warnings and all seem to work.Using your snippet the previous warnings were like:
Couldn't map buffer 0 of 2 at position 100 for 2097052 bytes with offset 100, new file Length:2097252, file:/mnt/shared/graphs/cyprus-gh/nodesEmux
Cruiser - Atlas
karussell commentedon Nov 7, 2014
Nice, thanks for the update! Please reopen or create a new issue if you find something strange
fix bug if custom model enabled graphhopper#217
improve error handling: allow selection and reduce garbage, fixes gra…
Move algo selection into Api.ts, graphhopper#217