3. Getting Geospatial Data#

3.1. Introduction#

3.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

3.3. Basemaps#

3.4. Census data#

3.5. The National Map#

3.6. OpenStreetMap#

3.7. OpenAerialMap#

3.8. Creating vector data#

3.9. Editing vector data#

3.10. Creating raster data#

3.10.1. From GeoTIFF#

3.10.2. From NumPy array#

3.11. Planetary Computer#

3.12. AWS Open Data#

3.13. Custom STAC catalog#

3.14. Summary#

3.15. References#