MapHub API tutorial
Create a map from a CSV table

This is a detailed tutorial explaining the concepts behind MapHub's API.

As part of this tutorial, you'll create a Python script, which takes a table (in CSV format) and a directory of images and creates an interactive MapHub map, entirely programmatically.

The table
titledescriptionurlicon_defaulticon_customimagelongitudelatitude
British MuseumThe world-famous British Museum...https://www.britishmuseum.org/museumbritish.jpg-0.12801851.519294
National GalleryThe crowning glory of Trafalgar Square...starnational.jpg-0.12837451.508884
Tate ModernSitting grandly on the banks of the Thames is Tate Modern...https://www.tate.org.uk/visit/tate-modernmuseumtatemodern.jpg-0.09934251.507429
Victoria and Albert MuseumThe V&A celebrates art and design with 3,000 years'...https://www.vam.ac.uk/va.pngva.jpg-0.17163751.496884
The created Map

Source code for the tutorial on GitHub: repo - zip archive

Table on Google Docs: link

Preparation

You need Python 3.6+ and the requests library. The tutorial is the same for macOS, Windows and Linux. To install requests, run

pip3 install requests

You can download all the images and the table in CSV format on the following link: zip archive. The files for this tutorial are in the map_from_table folder.

Create your API token

If you haven't done it already, you need to make an API token for MapHub. This is explained on the following page: API docs.