Bluedot Innovation provides a location services platform that enables location-based commerce and social innovation across any industry where mobility and geospatial awareness can add value. With customers like News Corp, Shell and Samsung and a solution on Salesforce Marketing Cloud, common use cases include driving foot traffic and sales in retail stores, increasing sales at restaurants and bars through automated offers, and more.
The following guest post is by Andrew Stirling, Head of Engineering (Infrastructure) at Bluedot Innovation, who highlights how Bluedot is at the forefront of location-based services.
Planet Earth is big. Really, really big. So when Bluedot Innovation was building a new mobile SDK to provide extremely accurate geofencing, with very little overhead in cellphone battery usage, we needed our back-end platform to bear as much of the load as possible. Specifically, we needed a solution that could quickly and scalably report only the nearest geofences, where each could be a different shape and dimension.
We’ve been working with MongoDB for over three years now, and haven’t looked back. After some analysis, we found that MongoDB’s geospatial capabilities fulfilled our requirements perfectly, with fast geospatial index lookup and a variety of geospatial query operators available including $geoWithin, $geoIntersects, and $near / $geoNear. The flexibility granted by the GeoJSON standard means that we aren’t limited to the circle and square geofences that most of our competitors are offering. Instead, we are able to offer polygons that directly fit the contours of a building or outdoor feature. Where our competitors offer geofences no smaller than 50 meters across, we can offer infinitely thin lines drawn across, say, the entrance to a drive-in to detect the arrival of a new customer. Thanks to the flexibility that MongoDB’s native document data structures provide, we aren’t limited to the basic approaches that the incumbent providers offer and are instead able to act fast and disrupt the market.
The GeoJSON format allows Bluedot Innovation to accurately index a variety of different geofence shapes.
The implementation of these capabilities is remarkably simple, as long as the database schema complies with established standards. GeoJSON was recently fully formalized in RFC 7946, and its implementation in MongoDB adheres to the specification. We have two stacks that interface with the MongoDB database – a Java/Spring Data stack and a NodeJS/Mongoose stack. Support for geospatial tools in these frameworks is now quite complete, and the implementation process is straightforward.
In our experience, geographic searches in MongoDB are a heavily CPU-bound process. The indexing takes only a little more memory than a standard index, but the search query takes more CPU cycles. This is because performing a search on two-dimensional proximity is not a simple operation by itself, let alone when the lookup needs to be performed on a sphere rather than a flat Cartesian plane. We’ve experimented with a variety of data structures to optimize the lookup, but the naïve one performed well enough that we decided to keep it for the sake of programmatic simplicity. We added a solid cache layer to reduce load on the back-end.
MongoDB has continued to improve on their geospatial queries. The 3.2 release saw some very nice performance improvements which brought down our cost-per-query significantly. We’re excited that the geospatial component will continue to be enhanced and anticipate further expansions in functionality and performance.
In all, we’re very satisfied with our choice of MongoDB for our product’s back-end database, and we look forward to working with the MongoDB platform as it continues to grow.
To learn more about geospatial data and MongoDB, view our on-demand webinar.