How to set up an interactive map in 5 steps (PyCon SK 2022)

How to set up an interactive map in 5 steps (PyCon SK 2022)
Wrote Lukáš January 5, 2023

The PyCon SK 2022 conference, held in Bratislava, is an annual gathering of the Python community. It is organised by volunteers from the SPy organization dedicated to the propagation of the Python language and other open source technologies and ideas.

This year was also packed with interesting lectures and workshops, which attracted a lot of Python enthusiasts. In this article, we will present a topic that caught our attention for its simplicity, speed of implementation and the benefits it can bring.

The lecture is Set up an interactive map in browser in a few steps, presented by Mr. Vojta Filipec. What did we learn in it?

  • How to make an interactive, easy-to-share map
  • How to display points of interest (POIs)
  • Set the colour, size and shape of POIs on the map
  • Display a pop-up window with detailed POI information

Step 1

We will use OpenStreetMap to download information about the location of all libraries in Slovakia. Krok 1

Step 2

With transformations we modify the data into the desired shape. The complete code can be found at this link Krok 2

Step 3

Use the folium package to create and display the map. Krok 3_1 Krok 3_2

Step 4

We add points of interest - POIs - to the map, for which we can define a color, for example, according to a certain condition, as shown in the example on github. Krok 4

Step 5

In the last step, we set up a pop-up window that appears when you click on a POI. We will define a function that will create the pop-up and set it as a parameter when creating the POI. Krok 5_1 Krok 5_2

That's it! We've displayed the POIs on the map, set the POI color based on the condition, and created a pop-up that appears when you click on it. And this is what the final result looks like: Vysledok

The result can be further configured, such as changing the underlying map, or using different icons instead of the circles that indicate POIs. If you are interested in this map creation option, feel free to watch this talk, which is available on YouTube.

Company name

With any assignment, any client's request we look further and aim to do more than might be enough for others.

Postal address

Adaptiware, spol. s r.o.
Južná trieda 8
04001 Košice
Slovak republic

+421 905 724 771

© 2013 - 2024 - Adaptiware, spol. s r.o.