Hosting Your Own Google Maps: Pros and Cons

David Zhao
4 min readSep 7, 2020

--

Google made a stir amongst the developer community in 2018 when they dramatically changed the pricing scheme for Google Maps. In exchange for a $200 USD monthly credit, users of the Google Maps API now had to deal with the following price schedule:

Google Maps Price Sheet (Latest Version at https://cloud.google.com/maps-platform/pricing/sheet)

For many users, this dramatically increased their Google Maps API costs, with many complaining of 15x to 20x increases over their previous costs. Since Google Maps explicitly bans caching of the data from their services, this has made life much more difficult for many applications.

But do you really need Google Maps? They are undoubtedly the best in data aggregation and provide a host of other services integrated into their Maps platform, but does your use-case really need to know what traffic is like in New York at 7:21 A.M?

All this extra functionality has to be paid for

If you all you need is a basic map, there are other ways to get a map without emptying your wallet in the process.

The Alternative: OpenStreetMaps

The best free source of map data is OpenStreetMaps by the OpenStreetMap Foundation. They are supported by major companies including MapBox, Facebook, Microsoft (through Bing), who presumably want an alternative to the Google Maps monopoly. While it does not offer additional auxiliary data (e.g. reviews, live traffic, transit lines, etc.) as Google Maps, it has all that you could want from a basic map.

OpenStreetMaps styled using OSM Bright GL (https://openmaptiles.org/styles/#osm-bright)

You can also customize your own styling using the MapBox Style Specification at https://maputnik.github.io/ as well as add your own layers for data visualization. Many alternative map providers including MapBox and MapTiler use or base their maps on OpenStreetMaps data.

You can find more information about switching to OpenStreetMaps at https://switch2osm.org/

Hosting Your Own OpenStreetMaps

If you go with an alternative provider, however, you’re just delaying the cost problem. Sure, MapBox may be cheaper than Google Maps, but you still can’t cache your requests. You could also use the volunteer servers at openstreetmaps.com, but try explaining to your boss why your app is down and there’s nothing you can do about it.

https://uptime.openstreetmap.org/ on Sept. 7 2020

Hosting your own OpenStreetMaps server is not as hard as it seems, especially if you have a more limited use-case and the geographical distribution of your users is limited to only a few countries. You may not even need your map to be updated every day, but maybe once a year or so.

There are two main parts to hosting your own OSM server: 1. Importing the map data and 2. Generating and serving map tiles (images) generated from the map data. Both importing the map data and generating map tiles can take a long time even with lots of computational power, but it can still be much cheaper than the alternative if you only need to do it once in a month or even a year. Not to mention, you can cache your map tiles on a CDN and further lower the hosting requirements.

Pros

  • Much cheaper and infinitely-scalable (with a CDN) for simple use-cases.
  • Complete control over the styling of your map
  • Easy integration with additional data visualization layers

Cons

  • Takes more work than hooking up a library to an API.
  • None of the fancy data aggregation services from Google (traffic, reviews, businesses, etc.)

Use Case: Static Map Images

At WOWA.ca, we generate static map images with markers to display the transactions of our real estate agents. These are captured at a zoom level of 10 (city-level) and needed no additional map services. Using the Google Maps API was costly and over-featured for what we needed. Generating and hosting our own maps and static map images server dramatically reduced our costs down to negligible amounts. We will likely only need to generate the map tiles once a year and the rest of the time serve them through a cache on AWS Cloudfront.

Next Up: A Step-By-Step Guide to Setting Up Your Own Map Server with OSM Map Data

If you have decided that hosting your own map server is the best option, I will be publishing a series of posts on how to get started with your own map server. Be sure to stay tuned!

Comments and Suggestions

The key to knowledge is knowing what you don’t know. Help me out and leave a comment or suggestion to let me know your own experience, ideas, or questions.

--

--

David Zhao
David Zhao

Written by David Zhao

Full-Stack Engineer at Stripe

No responses yet