Self-hosted interactive online maps
- Open source map hosting
With MBTiles-PHP you can publish interactive online maps (much like Google Maps) that you have created yourself with freely available software like “TileMill”. To this day it remains one of the most popular choices to self-publish such maps.
In the Country Profile Database we needed to display data of a geographical nature.
To make this data easier to comprehend, we wanted to display them on an interactive online map, so it's easier quickly get an overview of the data. A typical solution for such a problem would be to create a Google Maps widget with some custom data markers. However, in our case, that was not an option: Countries, country borders and country names and area designations are politically highly sensitive subjects. For that reason, we chose to create our own map using the excellent TileMill software, and to automatically update that map when new data became available.
By default, these maps could only be hosted by the company that creates the (open source) TileMill software. The WMO preferred to not have such external dependencies, which is why we decided to write our own software to host these maps.
The map itself lives in a file called an ‘.mbtiles’ file. When a user requests the online map, our open source software processes this file so that the user is presented with just the information he or she needs. The end result is something like this:
The ‘.mbtiles’ file is actually an SQLite database. It contains many small images (tiles) that, when placed next to each other, make up the actual map. Each of those tiles is 256x256 pixels large. Additionally, the ‘.mbtiles’ file contains an UTFgrid file for each of the tiles. With the UTFgrid file it becomes possible to mark geographical regions in the map, and use them for interactivity.
What our software does is provide a mechanism to extract the tiles and the UTFgrid files from the ‘.mbtiles’ file with nothing more than a simple php-script. This removes the need for an external hosting provider and reduces operational complexity, and as such was an important and necessary improvement for the Country Profile Database.
We can do stuff like this for you too! So if you’re interested, don’t hesitate to contact us!