1
votes

As I needed to implement "snap GPS location to road" function for an Android application I've modified Android example of https://github.com/graphhopper to suit my needs. It actually did what was expected, but now I'm quite confused about data format i should provide to users device.

Is it possible to provide pbf.osm files? What should I do to provide the user as small data chunks as possible?

Or is this a completely wrong approach to achieve "snap to road" to a native Android app (not web based)?

1
You can do it with graphhoper. Just deploy the created folder to the device with all the graphhopper files like it is described in the Android docs. - Karussell
BTW: if you have a GPX file with multiple GPS locations and time associated the snapping to road is called map matching. This post explains this a bit: karussell.wordpress.com/2014/07/28/… - Karussell

1 Answers

0
votes

I'm not that familar with Graphhopper in detail, but please take into account that it's just an routing engine and thus tuned for that purpose.

What you are looking for is a very simple method of 'reverse geocoding' that just returns the clothest point on a road for a given geopos. This doesn't work on a (simplified) routing graph as routers does, but on a optimized structure that is just tuned for geospatial queries. Maybe there are existing offline maps frameworks that already implement it?