Using WarpLib geo functions, solve two simple (?) questions, and win the code contest!
Mathias explained in its geoshape article, one of the core technology behind Warp 10. HHCODES usage explains why Warp 10 is so fast for geo functions. Take time to read this article if you didn't.
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/100 km) × (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
To submit your answers, send your WarpScripts (or FLoWS) to the SenX team by private messages on Warp 10 Slack, or by direct message on Twitter.
The first to get the correct answers will be declared the winner!
Help
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 data points that are on the road.
TIMESPLIT
or MOTIONSPLIT
may help you. Look at this article.
mapper.hspeed
will help you to compute speed. Beware Americans fellows, it returns SI units. Speed is m/s, not mph or km/h.
To see the results, it's here. |
Read more
Thinking in WarpScript - Multi-Value Support
Build a BACnet datalogger with a Raspberry
Connecting a BeerTender® to Warp 10 using MQTT on LoRaWan with TheThingsNetwork
Electronics engineer, fond of computer science, embedded solution developer.