I have a truck IOT fleet that uses cameras in realtime to detect road/infrastructure damage while in motion. Events are created with GPS coordinates. I have a need for querying Events “near” a target coordinate - both for viewing results, and for determining if this “area” has been logged as damaged already (a duplicate entry). I wired these up in Losant Workflows as a test, and the problem is in querying that result.
The Workflow Event Get returns all records without regard to locality, but they could be 1000 miles away. So I run Losant Loop and then a Geolocation on them, and if it’s nearby a radius, copy and return it to the array and so on. This technically works, but is basically an N + 1 issue (for each result, run function).
The problem is that this takes 2,000 - 5,000 ms to process, and I’m still in test mode, with just 1600 sample records populated - so it won’t scale.
Is there a better way within the Losant Platform to store Events in a way that can be queried by nearby Geolocation?
Or am I better off to just store this data outside Losant?