Dear friends, I’m developing an android app and I need to find the closest edge from latitude and longitude.
Snap qr = hopper.getLocationIndex().findClosest(latitude, longitude, EdgeFilter.ALL_EDGES);
With small osm.pbf files (1/2 MB) everything was ok, now instead i load the following osm.pbf file
Sud Italy (more or less 250 MB) I’m getting this error:
E/AndroidRuntime: FATAL EXCEPTION: Timer-4
Process: com.*.*, PID: 24530
java.lang.OutOfMemoryError: Failed to allocate a 1284541136 byte allocation with 25149440 free bytes and 238MB until OOM, max allowed footprint 311732600, growth limit 536870912
at com.graphhopper.storage.BaseGraph.fetchWayGeometry_(BaseGraph.java:400)
at com.graphhopper.storage.BaseGraph.access$100(BaseGraph.java:43)
at com.graphhopper.storage.BaseGraph$EdgeIteratorStateImpl.fetchWayGeometry(BaseGraph.java:864)
at com.graphhopper.storage.index.LocationIndexTree.traverseEdge(LocationIndexTree.java:331)
at com.graphhopper.storage.index.LocationIndexTree.lambda$findClosest$1$LocationIndexTree(LocationIndexTree.java:283)
at com.graphhopper.storage.index.-$$Lambda$LocationIndexTree$IxB7P67mFqGhKi5xV92xZXcW4ZE.accept(Unknown Source:13)
at com.graphhopper.storage.index.LineIntIndex.fillIDs(LineIntIndex.java:151)
at com.graphhopper.storage.index.LineIntIndex.findEdgeIdsInNeighborhood(LineIntIndex.java:242)
at com.graphhopper.storage.index.LocationIndexTree.findClosest(LocationIndexTree.java:280)
at com.*.*.adapters.GraphhopperRouteAdapter.findClosestEdgeFromPoint(GraphhopperRouteAdapter.java:285)
I already added
android:largeHeap=“true”
android:hardwareAccelerated=“false”
in my AndroidManifest but nothing is changed. Any suggestion about this problem?
Thanks