Creating a full maps stack without Google

After Google increased their map prices significantly (by about 100x in my case) I had to set about finding alternatives. It turned out the DIY approach was far easier than I expected and is saving thousands of dollars every month.

The end result we came up with looks professional with most people not noticing any difference, and it’s flexible so it can be easily tailored to differing requirements.

The primary downsides are satellite imagery is hard to get in a consistent and high quality way for free, and Google of course is still one of the only providers of Street View imagery.

Data quality hasn’t been an issue at all – OpenStreetMaps has matured and gives stunning detail plus government agencies are providing more data for free than ever, such as the Australian G-NAF data enabling flawless geocoding.

Preparing Map...

We ended up with a software stack consisting of the following:

Map Display
Imposm, PostgreSQL, Mapnik and mod_tile work together to process the raw OpenStreetMaps data and serve up the map tiles. Currently we are handling 350 map tiles per second on average, after the Content Delivery Network, with minimal server load and other than a multiple day long data processing time with Imposm everything is quite smooth.

Geocoding
We are using Pelias for geocoding which turned out to more involved than the other tools and producing the datasets (stored in ElasticSearch) consumes crazy amounts of memory – I was using a 384 gig ram 48 CPU server for two days to index the data. Part of the complexity is from bringing multiple datasets together including OpenStreetMaps, OpenAddresses and WhosOnFirst to produce better quality data.

A couple of bugs affecting accuracy for Australia have been found, but the developers are quite active and are improving the system so it should improve significantly in the short term.

Routing
I settled with Valhalla for map routing. I did try OSRM but it seems poorly designed for whole planet datasets (it keeps the entire database in memory, requiring excessive amounts of memory to work properly). Processing the dataset was pretty trivial and we even get multiple modes of travel – driving, walking and biking. It does support public transport as well however I haven’t attempted to build that dataset yet.

Preparing Map...

In the end I got a high performance mapping system that does 95% of what we used Google Maps for, with only the cost of an additional server (~$500/month) and a couple of weeks of time. It’s actually better than that however as now we’ve bothered to source the raw data sources it means I can begin to use them in new ways that I couldn’t have done with Google Maps.

One example is Isochrones – a radius around a point dictated by travel time. With other providers this is very expensive or impossible to do but it’s a very intuitive feature to users and Valhalla allows us to generate them very quickly with no extra effort.

Leave a Reply