Saturday, January 24, 2015

Dynamic Driving Directions with Turf


Turf is now available as a Mapbox.js plugin and can be used to perform many common GIS operations. Over the last few weeks the Mapbox blog has been posting a number of interesting examples of how Turf can be used with the Mapbox platform:

Dynamic walkability estimation with Turf
Find your nearest cup of coffee with Turf
Turf for local gov: potholes and parking meters
Analyzing 60 years of tornadoes with Turf

The posts on the Mapbox blog provide a number of useful use cases of how Turf can be deployed with Mapbox and provide some useful tips for anyone who is looking to develop a Mapbox based map using the Turf plug-in.


On Thursday Mapbox posted a very nice example of using Turf with Mapbox driving directions. Keep on truckin' with Turf.js and Mapbox Directions animates a marker along a route from San Francisco to Oakland.

As the marker follows the driving route all the nearby electric vehicle charging stations are automatically added to the map using Turf's .distance() method. You can test how fast Turf can process data on the fly by dragging the start and end destination markers on the map to create a new route. Change the route and you can see how the nearby electric vehicle charging stations are updated instantly on the map.

As the animated marker follows a route you can also select any of the charging station markers on the map. The route is then automatically updated to take in a stop at the selected charging station.

No comments:

Post a Comment