May an extension read the offline map store, and is there a supported way to get the road network ahead?
I built a coaching extension that computes per-segment power and speed targets from rider physics. Using karoo-ext 1.1.9, OnNavigationState gives me everything I need while a route is loaded: polyline, routeElevationPolyline and climbs all work well on a Karoo 2.
Many riders using it don't load a route. For them I'd like the road network ahead of the rider so I can look ahead to the next junction and estimate gradient. Two questions:
-
The offline maps live on shared storage at /storage/self/primary/offline/maps/*.map in standard Mapsforge format, readable with the normal storage permission. Is an extension permitted to read those files? Is that location something you'd consider stable across firmware updates, or should I treat it as private and not rely on it?
-
Is there a supported or planned karoo-ext API for the roads or elevation near the rider without navigation running, similar to what NavigatingRoute provides once a route is loaded? Even an elevation-along-heading lookup would cover my case.
If reading the map store is not something you want extensions doing, I'd rather know now and build my own road and elevation data instead. Thanks.
-
I think the Mapsforge data does not contain elevation if I remember correctly, as it's not required to draw the map (The recently added contour lines are precalculated polylines stored elsewhere I think). It does contain other useful data like surface types though.
It would be amazing if HH added access to the predicted route and its elevation to extensions as you suggest. Or even better, low level access to the routine engine and its data. They have not added new features to the SDK for more than a year or so though, and seem to be happy with what is there currently. They generally do not engage with third party developers here or on the defunct github issue tracker.
-
Thanks, that matches what I found. I opened the Karoo's ontario.map with mapsforge-map-reader: it has highway type, name, surface, tracktype, cycleway and oneway, but no elevation, as you say.
Two things others may find useful. First, the routing tiles beside the map (
.gph.gz, Valhalla format) do carry elevation per edge. I compared their per-edge mean elevation with my own surveyed profile along a 45 km ride and it agrees within a few metres, though a long rural edge gives only one value, so the shape inside the edge is lost.Second, karoo-ext 1.1.9 already gives an extension the loaded route's elevation: subscribe to OnNavigationState and the NavigatingRoute carries routeElevationPolyline, a 30 m profile of the whole route, plus the climbs list. On my Karoo 2 that worked, with the caveat that the state is delivered on subscribe and not pushed when navigation starts later, which I filed as karoo-ext issue #81. So the gap is only free riding without a loaded route.
Has anyone here parsed the Valhalla tiles on-device, or heard whether reading the offline map store is tolerated by Hammerhead? I would rather build on something supported than on files that may change.
Please sign in to leave a comment.
Comments
2 comments