Google Maps to the Rescue

google_mapFor many years, Llamawerx has developed and maintained on-board firmware for a client’s vehicle tracking product. If you’re familiar with GM’s OnStar, then you’re familiar with the type of system. Our version also targets commercial fleet trucking and adds a feature called geo-fencing. Geo-fencing allows the customer to define a virtual fence that the vehicle is confined to or excluded from. Our client’s existing product provided circular fences, but customers were making a case for square fences, rectangular fences and other shapes. Thus the request to Llamawerx, “Can you add polygon fences to the product?”

The Llamawerx answer: “Sure.”

Our client provided an algorithm from another product and some web searching turned up other algorithms to determine if a point is inside or outside a polygon. The software is written in C and runs on special embedded hardware in the vehicle. “Before spending a lot of time writing code for this special environment, testing and debugging, I wanted to make sure the algorithms worked,” said Doug Griswold CEO of Llamawerx. “Plus, I needed a simple way to define the points of interest and put them in a format that would work in the embedded device. Having used Google Maps in the past, I wondered if I could create a testbed based on the Google Map API and some Javascript.”

After a few hours, we had something that allowed us to plot points, define polygons and test our algorithms. Griswold continued, “Once I was confident the Javascript algorithm correctly identified the point inside or outside of the polygon, I added functionality to output the configuration.” Now it was time to switch gears and tackle the embedded Open AT code.

“First, I added the data definitions and configuration interface to the embedded application,” said Griswold. “I defined the data structures in Flash and RAM, created the custom AT commands to accept the configuration and added an over-the-air interface too. Once the groundwork was laid, I could concentrate on the relatively simple task of translating the Javascript code to C.”

After some stationary scenarios, it was time to take a drive and see how the whole thing worked. “I pulled together some Javascript from an earlier test program and added it to the Google Map testbed,” said Griswold. “Now I could see the alerts from the vehicle displaying on the map with our polygon and circular fences. After driving around town, I would review the results and compare them with the definition on the map. It was amazing how quickly I could spot inconsistencies, make the changes and head out for another test run.”

Google Maps and Javascript allowed Llamawerx to quickly put together a testbed, flesh out the algorithms and verify the real-world results. To learn more about specific technologies in the Llamawerx tool chest, visit or contact us at

Comments are closed.