ffwdme / ffwdme.js

[DEPRECATED!] 🛑 A JavaScript toolkit that aims to bring interactive GPS driving directions to the mobile browser
http://ffwdmejs.org
MIT License
153 stars 36 forks source link

Suggestion : get geolocation data from outside #38

Closed nabil-g closed 6 years ago

nabil-g commented 6 years ago

Hi, I plan to use this library for a personal project so I am wondering if it would be possible to get the user position from an outside source (e.g an arduino shield sending data through a serial port to a node script, and then through a socket to the browser ? Instead of using html5 geolocation api

Thank you for your job !

fabrik42 commented 6 years ago

Hi! Yes, this is already possible!

Here you can find a basic implementation that uses this feature: https://github.com/ffwdme/ffwdme.js/tree/master/src/debug/geoprovider In this special case it is about the replay of a recorded route, so you can debug from home, instead of driving around all the time :)

The interesting part is this:

https://github.com/ffwdme/ffwdme.js/blob/a704b020fd4aff180a8e93d8e9716648256a226f/src/debug/geoprovider/player.js#L62-L67

That's all that should be necessary to insert custom locations into ffwdme.

Closing this issue for now, but please feel free to reopen (or open another one) if you need any more help!