The Problem
In May of this year, Google announced some major changes to the pricing plan for their Maps service - the API which had been largely free in the past would now require billing details to function correctly and would charge per render, with a modest initial free allowance. Plenty of developers voiced their frustration at the changes, and our own dev team had to formulate a plan as to how we were going to deal with the embedded Google Maps that were on the majority of our clients’ sites.
At first we looked into the viability of keeping the original maps in place and adding billing details for each map, however it quickly transpired that this would be problematic. The Google Cloud Platform doesn’t allow caps on API calls easily, malicious troll scripts could start appearing to spam-refresh maps pages, and if Google had shown willingness to make such a sharp price increase once, they may well do so again the future. This led us to consider alternative maps, with the most natural choice being built around OpenStreetMap.
The Solution
OpenStreetMap (‘OSM’) is a massive, freely-available dataset containing a variety of geographic information from across the world. There is an impressive community built around the project, and the likes of Microsoft, Apple and Facebook are contributing to it. Contributors from across the globe supply different types of local data to keep OSM up-to-date and accurate, and their work ensures that the raw data is as detailed, if not more so, than Google’s equivalent dataset.
Unfortunately, if raw map data was output on a page, it probably wouldn’t help your users navigate to your business premises, so some additional steps are required. To turn OSM data into something more helpful, many providers use Mapnik, an open-source tool for converting geospatial information into ‘tiles’, essentially images which visually represent the map data and can be used by websites. In the process, these tiles can be customised to have varying colour schemes, use different language options etc, before being hosted on a tileserver from which your site can retrieve them.
Lastly, a lightweight JavaScript library called Leaflet is used to retrieve, display and manipulate the tiles into a map, rendering a collection of images together to form a map. It works just as intuitively as Google Maps, with the ability to scroll-zoom in and out, click-and-drag to move around, options to display satellite imagery, markers, popups, and extension libraries to allow routing, geocoding, and even run social simulations.
The Future
With more people migrating from Google Maps to OSM, and more major players in the market lending their support to the project, the quality and accuracy of the data is only set to improve further. At Indulge, we’re excited about the new possibilities afforded to us by OSM, and we’re already planning what additional customisations and additions we can make to improve our maps even further.
We found the transition to OSM smooth, and the quality of the output to be arguably better than Google’s offering in many ways. The fact that the project is open-source is a big plus for us and our clients, not only because of the cost savings, but because of the flourishing community who are committed to improving the project. Overall, while we initially shared the frustrations of developers around the world at the price increase, using OSM allows us to offer our clients and users a cheaper, more flexible, and fundamentally better product.