15. Introduction to Geospatial Python#

15.1. Introduction#

15.2. The Geospatial Python Ecosystem#

15.2.1. Foundation Libraries#

15.2.2. Data Structures and Analysis#

15.2.3. Interactive Visualization#

15.2.4. Specialized Analysis#

15.2.5. Application Development#

15.3. Understanding Library Relationships#

15.4. Setting Up Your Environment#

15.4.2. Option 2: Using pixi (For Complex Dependencies)#

# Install pixi
# macOS and Linux:
curl -fsSL https://pixi.sh/install.sh | bash

# Windows:
iwr -useb https://pixi.sh/install.ps1 | iex

# Initialize project and add dependencies
pixi init
pixi add pygis jupyterlab
pixi run jupyter lab

15.4.3. Option 3: Using conda/mamba (Traditional Approach)#

# Create environment
conda create -n geo python=3.12
conda activate geo

# Install from conda-forge
conda install -c conda-forge mamba
mamba install -c conda-forge pygis

15.5. Verification and First Steps#

# Test core geospatial libraries
import geopandas as gpd
import rasterio
import xarray as xr
import rioxarray
import leafmap
import pandas as pd
import numpy as np

print("✓ All core libraries imported successfully!")

15.5.1. Create Your First Interactive Map#

# Create an interactive map using Leafmap
m = leafmap.Map(center=[40, -100], zoom=4, height="500px")

# Add different basemap options
m.add_basemap("OpenTopoMap")
m.add_basemap("USGS.Imagery")

# Display the map
m

15.6. Learning Path and Chapter Overview#

15.6.1. Foundation (Start Here)#

15.6.2. Visualization and Interaction#

15.6.3. Specialized Analysis#

15.6.4. Foundation and Integration#

15.6.5. Application Development#

15.7. Key Concepts to Remember#

15.8. Getting Help and Resources#

15.9. Next Steps#

15.10. Exercises#