Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lab 8

image image

Overview

This lab introduces you to MapLibre, an open-source library for creating highly customizable, interactive 2D and 3D maps in Python. You will gain practical experience using MapLibre in conjunction with the Leafmap library to develop dynamic geospatial visualizations. This lab covers fundamental tasks, such as setting up MapLibre, creating a map, and customizing views, as well as more advanced functionalities, such as overlaying data layers, adding 3D buildings, and adding map elements.


Objectives

By completing this lab, you will be able to:

  1. Set up MapLibre in Python and initialize a basic map.

  2. Customize map properties, including basemap styles, zoom levels, pitch, and bearing.

  3. Add interactive controls, such as geolocation, fullscreen, and drawing tools, to enhance user experience.

  4. Integrate various data layers, such as GeoJSON, XYZ tiles, and WMS layers, to enrich map content.

  5. Work with 3D visualizations, including extruded buildings, for enhanced spatial representation.

  6. Add map elements, such as image, text, and GIF, to the map.

# %pip install "leafmap[maplibre]"

Exercise 1: Setting up MapLibre and Basic Map Creation

Exercise 2: Customizing the Map View

Exercise 3: Adding Map Controls

Exercise 4: Overlaying Data Layers

Exercise 5: Working with 3D Buildings

Exercise 6: Adding Map Elements