Self-hosted Open-Source Cheap alternative for Google Maps API services
When you need a map to embed it on your site, or you need to make an address autocomplete — the first thing you probably think about is Google Maps. While this is the most straightforward and perfect solution, it can be quite expensive. That is why we at Go Wombat are always trying to find cost-effective solutions for our clients.
There is an alternative called OpenStreetMap. It will require more effort to set up, but you will have full control over it, and the price you need to pay — is only the price for the server. For applications with a big load, it can be a great benefit. But let’s investigate.
Price comparison
Google Maps API
Google maps geocoding API costs 5$ per 1000 requests until it’s 100,000 requests, then 4$ until 500,000. So let’s say we have a maximum of 500,000 requests per month — that will cost $2100.
Google Maps Services price calculator
DigitalOcean Server
The cheapest server on Digital Ocean will cost $5 per month. But since we have 500,000 requests per month — probably it will be not enough. So an average server with 8 GB RAM, 4 CPUs, and 160 GB SSD disk — will cost $40. And even the top high-end server will cost $960. It will have 192 GB, 32 CPUs, and a 3.75 TB SSD disk!
Tools to use
We used Photon for search-as-you-type with multilingual support and geocoding. Photon is an open-source geocoder built for OpenStreetMap data. It is based on elasticsearch — an efficient, robust, and highly scalable search platform.
Alternatively, you can use Nominatim for geocoding as well. But we found Photon simpler to set up and use.
OSM Tile Server
So, if you want to go fully self-hosted, you will also need to render a map on your service. For that purpose, you will need to set up an OSM Tile Server.
The main problem here, that’s from the different sources — the data for Tile Server may take up to 3 TB of space. And Volume on DigitalOcean for 3 TB will cost $300 per month.
Cheapest solution
Pricing for Google Maps Embed API
Google Maps Embed is free so you can use it as a map provider. And set up a Photon for geocoding and autocomplete.
If you have any questions please let us know