4. Working with Geospatial Data#

4.1. Introduction#

4.2. Technical requirements#

To follow along with this chapter, you will need to have leafmap and several optional dependencies installed. If you have already followed ch1:install - Installing leafmap, then you should already have a conda environment with all the necessary packages installed. Otherwise, you can create a new conda environment and install pygis with the following commands, which will automatically install leafmap and all the required dependencies:

conda create -n geo python
conda activate geo
conda install -c conda-forge mamba
mamba install -c conda-forge pygis

Next, launch JupyterLab by typing the following commands in your terminal or Anaconda prompt:

jupyter lab

Alternatively, you can use leafmap in a cloud environment without installing anything on your local computer. Click on one of the following links to launch a cloud-based JupyterLab server:

Once in the selected cloud environment, you can uncomment the following line and run the cell to install pygis, which includes leafmap and all the necessary dependencies:

# %pip install pygis

The installation process may take 2-3 minutes. Once pygis has been installed successfully, restart the kernel to enable the newly installed packages.

To begin, import the necessary libraries that will be used in this chapter:

import leafmap

4.3. CSV to points#

4.4. Split raster#

4.5. Merge raster#

4.6. Raster inspector#

4.7. Image comparison#

4.8. Image overlay#

4.9. Heat maps#

4.10. Choropleth maps#

4.11. Summary#

4.12. References#