| Thread Previous • Date Previous • Date Next • Thread Next |
On 28 April 2015 at 13:16, Alan Bell <alanbell@xxxxxxxxxx> wrote: > lets talk about doing it properly. > > text to speech can be done quite nicely with an offboard openMary server, > if we have the route we can make the voices happen. You can run a speech > synth on the device (I have, it works, it is a bit slow) but there is no > real need to do so. > OpenStreetmap data powers OSRM http://map.project-osrm.org/ which is a > web service that can return a route between two waypoints, it is pretty > good, it returns a json format containing the route geometry and the turn > instructions > > > https://router.project-osrm.org/viaroute?z=14&output=json&jsonp=OSRM.JSONP.callbacks.route&checksum=1921722824&loc=51.212166,-0.795507&hint=RZ4NADoRyAN9GAAACQAAAAoAAABAAAAAFAAAAD4p2QUAAAAAg28NA43c8_8CABEA&loc=51.249680,-0.763185&hint=RxO1BEoTtQSHQTAAKQAAAAAAAAAAAAAAAAAAAP____8AAAAADgIOA89a9P8AABEA&instructions=true > This much - requesting a route between two points and displaying the route on the map - is possible already using the QtLocation API. I have an outstanding PR [0] for OSMTouch that adds it, albeit in a fairly rough-and-ready fashion. > the turn instructions are like this: > > Head southwest onto Abbey Street - 0.10 km > Turn right onto A287 - 0.16 km > Turn slight right onto Victoria Road - 0.22 km > Turn right onto A325 - 44 m > Continue onto B3001 - 0.13 km > Turn slight left - 49 m > Continue onto A31 - 1.22 km > Enter roundabout and leave at third exit onto A325 - 0.15 km > Enter roundabout and leave at first exit onto A325 - 0.43 km > Enter roundabout and leave at third exit onto Weybourne Road - 48 m > Turn slight left onto B3007 - 1.77 km > Turn left onto Ayling Lane - 0.53 km > Turn slight left onto Ayling Hill - 0.17 km > Turn right onto B3008 - 0.55 km > Turn left onto Lime Street - 0.14 km > Enter roundabout and leave at third exit onto Alexandra Road - 0.15 km > Turn left onto Barrack Road - 73 m > Turn slight left onto B3007 - 36 m > Continue onto High Street - 0.33 km > Turn right onto Bakehouse Mews - 26 m > You have reached your destination > The very same API also makes this available. Well, almost. There's a bug, I think on the OSRM server, whereby the Qt API expects the routing_information array elements to have eight items and the server is returning nine, except for the "You have reached your destination". I haven't figured out a way to work around this (the plugin [1] is written in C++), other than re-implementing the whole thing. But taking the response, dropping the ninth element, serving it up from a local web server and adjusting `/etc/hosts` accordingly, I've been able to dump the turn-by-turn instructions to the console. So it's almost there. > > so, we can get the turn instructions, we can get the latlng of the start > of each leg of the journey, we can get the text as a sound file. Lets say > we do all that, and I have a list of sound files I want to play when I get > to an appropriate place to play them. How do we get the right sound file to > play when we are approaching the start of the leg? Some kind of geofencing > event interface? Is there an operating system facility to wake up an app > when the GPS enters an alarm area? > I recall conversations about this in the past (on this very list, if memory serves), but I don't recall ever seeing a conclusion. It sounded like a Hard Problem. But if we're talking about a satnav-style app, we probably want to keep the screen (and thus the app) awake and the map on-screen at an appropriate zoom level. Maybe this is an easier problem to solve. > > Of course, this doesn't solve the problem of getting it wrong and going > off-route and recalculating and finding a new route, but I think that is > solvable if we can get some facility to do a geofencing wake up. > > Alan. > I think re-routing is the easy part, yes. Detecting that we need to re-route shouldn't be difficult either. I'm itching to tinker more, but I'm not confident that OSMTouch is maintained, or that I have the skill and time to fork it and do a better job. JT [0]: https://github.com/yohanboniface/OSMTouch/pull/1; [1]: http://osxr.org/qt/source/qtlocation/src/plugins/geoservices/osm/qgeoroutereplyosm.cpp
| Thread Previous • Date Previous • Date Next • Thread Next |