How to build static maps with overlays

Dream Science
Geek Culture
Published in
5 min readAug 4, 2021

--

Google Maps

There are very few ways to generate static maps with complex data overlays. What is a static map with data overlays? It’s an image of a current map base layer styled either as a satellite or plain street view with some shapes, markers etc rendered on top of it.

Why would anyone need a static map if you can take Google Maps API and build a rather dynamic visualisation with fairly simple Javascript? It has a very limited use case, indeed. Simply put, this dynamic application needs an internet connection to work and you may find it tricky to print a map hard copy or embed it into some other media like PDF.

In my case, we had to generate a PDF document having several embedded static maps with quite complex polygons at high precision.

Option #1

Google Maps Static API

If it suits you then you are quite lucky! There’s nothing complex and if you are familiar with some Javascripting or any low-code platform it literally will take only a couple of hours to implement.

Limitations to be aware of before looking into it:

  • Static map image will not exceed 640x640px. Although, you may request Google to increase it.
  • Encoded polyline size plus some other parameters must not exceed 8KB. This is a hard URL length…

--

--