Using WarpLib geo functions, solve two simple (?) questions, and win the code contest!
From the information in this blog post, I imagined a little code contest for you.
A car is driving in Arizona, with a GPS datalogger… I give you the GPS track, and two questions!
Questions to solve
Given the Route 66 geoshape and the GTS from the datalogger:
- How many kilometers did this car on the Route 66?
- Its fuel consumption approximation is 8 (liters/100km) × (speed (km/h) / 80) +1. One liter of fuel releases 2392g of CO2. How many CO2 did the car released while driving on the Route 66?
Submit your results
The first to get the correct answers will be declared the winner!
You can use WarpStudio and the Warp 10 sandbox endpoint. Here is the code snapshot.
In the dataviz tab, don’t forget to enable the map view
Sometimes, the car is not on the Route 66. But not always. Sometimes the car is really close. You will have to deal with that.
Useful WarpLib functions
mapper.geo.within will help you to keep datapoints that are on the road.
mapper.hspeed will help you to compute speed. Beware americans fellows, it returns SI units. Speed is m/s , not mph or km/h.