Google announced the new pricing model for its Map API platform in May, and will effectively increase the price by ~14x (yes, not 14% but 14 times) in mid July (link). It will also provide some free credits but it is far from enough if you are building a real product around it.
Instead of calculating the cost under the new model, I decided to do a little bit research and see if I can create something similar without huge effort. After Google-ing within half an hour, I found a good Javascript library Leaflet, which seems to be backed by multiple companies including Pinterest, Esty, etc.
Then I look at the tile (the actual image with the map displayed to end users). I know there is a awesome project called OpenStreetMap (I remember I contributed a few record when I was young, say 10 years ago) and they provided a server serving those tiles.
The first idea comes to my mind is to leverage on those tile server (without generating them myself), an idea of using nginx (i.e. proxy_pass + mod_cache) similar to
https://coderwall.com/p/--wgba/nginx-reverse-proxy-cache-for-openstreetmap
but it turns out that its policy prohibited me from doing it
Therefore I need to build them from sketch, good documentation are there like
https://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/
But I am too lazy and just look for a pre-built Docker image
https://github.com/Overv/openstreetmap-tile-server
You may execute the following commands and you will get a simple tile server ready:
git clone https://github.com/Overv/openstreetmap-tile-server
cd openstreetmap-tile-server# prepare the docker and run
docker volume create openstreetmap-data
wget http://download.geofabrik.de/asia/china-latest.osm.pbf
docker run -v $PWD/china-latest.osm.pbf:/data.osm.pbf -v openstreetmap-data:/var/lib/postgresql/10/main overv/openstreetmap-tile-server import
docker run -p 80:80 -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server run# open in browser: https://rawgit.com/Overv/openstreetmap-tile-server/master/leaflet-demo.html
HK01 is looking for talented engineers, check more at https://bit.ly/2I0YN5r