Creating a Tile Server in Go and Consuming in Leaflet | Architecture and Planning


I have used TileMill to create tiles and use them as a custom
basemap in Fulcrum app and I loved it. I wanted to be able to
do this in my web maps with Leaflet. After a short search, I
found the answer.

What I Wanted

There are tile servers already made for you, such as
TileStache, but I wanted to run a small, simple
server on windows and I couldn’t modify IIS, or install Apache.
How can I do this simply, without infrastructure?

What I Knew and Didn’t

I know a tile server splits data up in to images and serves
them based on zoom level and row and column.

I know TileMill is awesome and will export MBTiles for me.

I have no idea what an MBTiles file looks inside.

Github to the Resuce

I found a PHP tile server by Bryan McBride on Github. It was
the perfect example. From the code, it was clear that MBTiles
are just SQLite DBs. What?!?! That is brilliant and makes using
them simple. You just need to query for zoom level, row and
column – as Bryan did n his code.

I installed WAMP because it is the easiest way to get Apache
and PHP on my machine to test the PHP Server with my own tiles.
It worked with no problems. So I know I can generate tiles and
server them. Now I need to create a solution that did not
require Apache, PHP, or changes to IIS.

My Solution

I chose to work with Go. It would create a…

Read More