GeoMaster
Comprehensive geospatial science skill covering GIS, remote sensing, spatial analysis, and ML for Earth observation across 70+ topics with 500+ code examples in 8 programming languages.
Installation
Pick ONE package manager for the GDAL-backed stack. Modern pip wheels for
rasterio/fiona/pyproj/shapely bundle their own GDAL/GEOS/PROJ, so a pure-pip
(uv) env covers the core libs without a system GDAL. Do NOT mix conda-GDAL
with pip rasterio/fiona in the same env — the two ship different GDAL binaries
and the ABI mismatch segfaults. The standalone gdal Python bindings do NOT
bundle binaries (they need a matching system/conda libgdal); PDAL and rsgislib
likewise have no reliable pip wheels — get those via conda (Option B).
# Option A — uv/pip env (recommended here): wheels bundle GDAL/GEOS/PROJ.
# rasterio/fiona cover most GDAL needs; standalone `gdal` -> use Option B.
uv pip install rasterio fiona shapely pyproj geopandas
uv pip install torchgeo earthengine-api
uv pip install scikit-learn xgboost torch-geometric
uv pip install osmnx networkx folium keplergl
uv pip install cartopy contextily mapclassify
uv pip install xarray rioxarray dask-geopandas
uv pip install pystac-client planetary-computer odc-stac rio-cogeo
uv pip install laspy[lazrs] open3d # PDAL: use conda (no pip wheel)
# Option B — conda env (best for PDAL / rsgislib / system GDAL tooling)
conda install -c conda-forge gdal rasterio fiona shapely pyproj geopandas \
rsgislib pdal python-pdal postgis libspatialite
Quick Start
NDVI from Sentinel-2
import rasterio
import numpy as np
with rasterio.open('sentinel2.tif') as src:
red = src.read(4).astype(float) # B04
nir = src.read(8).astype(float) # B08
ndvi = (nir - red) / (nir + red + 1e-8)
ndvi = np.nan_to_num(ndvi, nan=0)
profile = src.profile
profile.update(count=1, dtype=rasterio.float32)
with rasterio.open('ndvi.tif', 'w', **profile) as dst:
dst.write(ndvi.astype(rasterio.float32), 1)
Spatial Analysis with GeoPandas
import geopandas as gpd
# Load and ensure same CRS
zones = gpd.read_file('zones.geojson')
points = gpd.read_file('points.geojson')
if zones.crs != points.crs:
points = points.to_crs(zones.crs)
# Spatial join and statistics
joined = gpd.sjoin(points, zones, how='inner', predicate='within')
stats = joined.groupby('zone_id').agg({
'value': ['count', 'mean', 'std', 'min', 'max']
}).round(2)
Google Earth Engine Time Series
import ee
import pandas as pd
ee.Initialize(project='your-project')
roi = ee.Geometry.Point([-122.4, 37.7]).buffer(10000)
s2 = (ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
.filterBounds(roi)
.filterDate('2020-01-01', '2023-12-31')
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)))
def add_ndvi(img):
return img.addBands(img.normalizedDifference(['B8', 'B4']).rename('NDVI'))
s2_ndvi = s2.map(add_ndvi)
def extract_series(image):
stats = image.reduceRegion(ee.Reducer.mean(), roi.centroid(), scale=10, maxPixels=1e9)
return ee.Feature(None, {'date': image.date().format('YYYY-MM-dd'), 'ndvi': stats.get('NDVI')})
series = s2_ndvi.map(extract_series).getInfo()
df = pd.DataFrame([f['properties'] for f in series['features']])
df['date'] = pd.to_datetime(df['date'])
Core Concepts
Data Types
| Type |
Examples |
Libraries |
| Vector |
Shapefile, GeoJSON, GeoPackage |
GeoPandas, Fiona, GDAL |
| Raster |
GeoTIFF, NetCDF, COG |
Rasterio, Xarray, GDAL |
| Point Cloud |
LAS, LAZ |
Laspy, PDAL, Open3D |
Coordinate Systems
- EPSG:4326 (WGS 84) - Geographic, lat/lon, use for storage
- EPSG:3857 (Web Mercator) - Web maps only (don't use for area/distance!)
- EPSG:326xx/327xx (UTM) - Metric calculations, <1% distortion per zone
- Use
gdf.estimate_utm_crs() for automatic UTM detection
# Always check CRS before operations
assert gdf1.crs == gdf2.crs, "CRS mismatch!"
# For area/distance calculations, use projected CRS
gdf_metric = gdf.to_crs(gdf.estimate_utm_crs())
area_sqm = gdf_metric.geometry.area
OGC Standards
- WMS: Web Map Service - raster maps
- WFS: Web Feature Service - vector data
- WCS: Web Coverage Service - raster coverage
- STAC: Spatiotemporal Asset Catalog - modern metadata
Common Operations
Spectral Indices
def calculate_indices(image_path, bands=(2, 3, 4, 8, 11)):
"""NDVI, EVI, SAVI, NDWI from Sentinel-2.
`bands` maps (B02, B03, B04, B08, B11) to the 1-based band indices in
your file. EVI's constants (6, 7.5, +1) assume surface reflectance in
[0, 1]; raw L2A DN are scaled by 10000, so divide first or EVI is wrong.
"""
with rasterio.open(image_path) as src:
B02, B03, B04, B08, B11 = (src.read(b).astype(float) for b in bands)
ndvi = (B08 - B04) / (B08 + B04 + 1e-8)
evi = 2.5 * (B08 - B04) / (B08 + 6*B04 - 7.5*B02 + 1 + 1e-8)
savi = ((B08 - B04) / (B08 + B04 + 0.5)) * 1.5
ndwi = (B03 - B08) / (B03 + B08 + 1e-8)
return {'NDVI': ndvi, 'EVI': evi, 'SAVI': savi, 'NDWI': ndwi}
Vector Operations
# Buffer (use projected CRS! 1000 = metres in UTM).
# Keep the result in the projected frame; don't bolt projected geometry
# back onto a geographic gdf or you silently mix CRS in one column.
gdf_proj = gdf.to_crs(gdf.estimate_utm_crs())
gdf_proj['buffer_1km'] = gdf_proj.geometry.buffer(1000)
# Spatial relationships
intersects = gdf[gdf.geometry.intersects(other_geometry)]
contains = gdf[gdf.geometry.contains(point_geometry)]
# Geometric operations
gdf['centroid'] = gdf.geometry.centroid
gdf['simplified'] = gdf.geometry.simplify(tolerance=0.001)
# Overlay operations
intersection = gpd.overlay(gdf1, gdf2, how='intersection')
union = gpd.overlay(gdf1, gdf2, how='union')
Terrain Analysis
def terrain_metrics(dem_path):
"""Calculate slope, aspect, hillshade from DEM."""
with rasterio.open(dem_path) as src:
dem = src.read(1)
dy, dx = np.gradient(dem)
slope = np.arctan(np.sqrt(dx**2 + dy**2)) * 180 / np.pi
aspect = (90 - np.arctan2(-dy, dx) * 180 / np.pi) % 360
# Hillshade
az_rad, alt_rad = np.radians(315), np.radians(45)
hillshade = (np.sin(alt_rad) * np.sin(np.radians(slope)) +
np.cos(alt_rad) * np.cos(np.radians(slope)) *
np.cos(np.radians(aspect) - az_rad))
return slope, aspect, hillshade
Network Analysis
import osmnx as ox
import networkx as nx
# Download and analyze street network
G = ox.graph_from_place('San Francisco, CA', network_type='drive')
G = ox.add_edge_speeds(G).add_edge_travel_times(G)
# Shortest path
orig = ox.distance.nearest_nodes(G, -122.4, 37.7)
dest = ox.distance.nearest_nodes(G, -122.3, 37.8)
route = nx.shortest_path(G, orig, dest, weight='travel_time')
Image Classification
from sklearn.ensemble import RandomForestClassifier
import rasterio
from rasterio.features import rasterize
def classify_imagery(raster_path, training_gdf, output_path):
"""Train RF and classify imagery."""
with rasterio.open(raster_path) as src:
image = src.read()
profile = src.profile
transform = src.transform
# Extract training data
X_train, y_train = [], []
for _, row in training_gdf.iterrows():
mask = rasterize([(row.geometry, 1)],
out_shape=(profile['height'], profile['width']),
transform=transform, fill=0, dtype=np.uint8)
pixels = image[:, mask > 0].T
X_train.extend(pixels)
y_train.extend([row['class_id']] * len(pixels))
# Train and predict
rf = RandomForestClassifier(n_estimators=100, max_depth=20, n_jobs=-1)
rf.fit(X_train, y_train)
prediction = rf.predict(image.reshape(image.shape[0], -1).T)
prediction = prediction.reshape(profile['height'], profile['width'])
profile.update(dtype=rasterio.uint8, count=1)
with rasterio.open(output_path, 'w', **profile) as dst:
dst.write(prediction.astype(rasterio.uint8), 1)
return rf
Modern Cloud-Native Workflows
STAC + Planetary Computer
import pystac_client
import planetary_computer
import odc.stac
# Search Sentinel-2 via STAC
catalog = pystac_client.Client.open(
"https://planetarycomputer.microsoft.com/api/stac/v1",
modifier=planetary_computer.sign_inplace,
)
search = catalog.search(
collections=["sentinel-2-l2a"],
bbox=[-122.5, 37.7, -122.3, 37.9],
datetime="2023-01-01/2023-12-31",
query={"eo:cloud_cover": {"lt": 20}},
)
# Load as xarray (cloud-native!)
# pystac-client >= 0.7: use search.items() (get_items() is deprecated).
items = list(search.items())[:5]
data = odc.stac.load(
items,
bands=["B02", "B03", "B04", "B08"],
crs="EPSG:32610",
resolution=10,
)
# Calculate NDVI on xarray
ndvi = (data.B08 - data.B04) / (data.B08 + data.B04)
Cloud-Optimized GeoTIFF (COG)
import rasterio
from rasterio.session import AWSSession
# Read COG directly from cloud (partial reads)
session = AWSSession(aws_access_key_id=..., aws_secret_access_key=...)
with rasterio.open('s3://bucket/path.tif', session=session) as src:
# Read only window of interest
window = ((1000, 2000), (1000, 2000))
subset = src.read(1, window=window)
# Write COG
with rasterio.open('output.tif', 'w', **profile,
tiled=True, blockxsize=256, blockysize=256,
compress='DEFLATE', predictor=2) as dst:
dst.write(data)
# Validate COG
from rio_cogeo.cogeo import cog_validate
cog_validate('output.tif')
Performance Tips
# 1. Spatial indexing (10-100x faster queries)
gdf.sindex # Auto-created by GeoPandas
# 2. Chunk large rasters
with rasterio.open('large.tif') as src:
for i, window in src.block_windows(1):
block = src.read(1, window=window)
# 3. Dask for big data (lazy, chunked, dask-backed DataArray)
import rioxarray
da_raster = rioxarray.open_rasterio('large.tif', chunks=(1, 1024, 1024))
# .data is the underlying dask.array if you need the raw chunked array:
# dask_array = da_raster.data
# 4. Use Arrow for I/O
gdf.to_file('output.gpkg', use_arrow=True)
# 5. GDAL caching
from osgeo import gdal
gdal.SetCacheMax(2**30) # 1GB cache
# 6. Parallel processing
rf = RandomForestClassifier(n_jobs=-1) # All cores
Best Practices
- Always check CRS before spatial operations
- Use projected CRS for area/distance calculations
- Validate geometries:
gdf = gdf[gdf.is_valid] (repair with gdf.geometry.make_valid())
- Drop missing geometries:
gdf = gdf[gdf.geometry.notna() & ~gdf.geometry.is_empty] (fillna(None) does NOT work on a geometry column)
- Use efficient formats: GeoPackage > Shapefile, Parquet for large data
- Apply cloud masking to optical imagery
- Preserve lineage for reproducible research
- Use appropriate resolution for your analysis scale
Detailed Documentation
- Coordinate Systems - CRS fundamentals, UTM, transformations
- Core Libraries - GDAL, Rasterio, GeoPandas, Shapely
- Remote Sensing - Satellite missions, spectral indices, SAR
- Machine Learning - Deep learning, CNNs, GNNs for RS
- GIS Software - QGIS, ArcGIS, GRASS integration
- Scientific Domains - Marine, hydrology, agriculture, forestry
- Advanced GIS - 3D GIS, spatiotemporal, topology
- Big Data - Distributed processing, GPU acceleration
- Industry Applications - Urban planning, disaster management
- Programming Languages - Python, R, Julia, JS, C++, Java, Go, Rust
- Data Sources - Satellite catalogs, APIs
- Troubleshooting - Common issues, debugging, error reference
- Code Examples - 500+ examples
GeoMaster covers everything from basic GIS operations to advanced remote sensing and machine learning.
1---2name: alterlab-geomaster3description: Covers geospatial science across remote sensing, GIS, spatial analysis, and machine learning for earth observation — satellite imagery processing (Sentinel, Landsat, MODIS, SAR, hyperspectral), raster and DEM operations, spectral indices (NDVI/EVI/NDWI), spatial statistics, point cloud processing, network analysis, and cloud-native workflows (STAC, COG, Planetary Computer), with examples across Python, R, Julia, JavaScript, C++, Java, Go, and Rust. Use for remote sensing workflows, satellite/raster image classification, terrain/slope/hillshade analysis, spatial ML on earth-observation data, hydrological modeling, marine spatial analysis, or atmospheric science. For pure tabular vector work with no raster/EO aspect (plain GeoPandas sjoin, buffer, overlay, dissolve, choropleths) prefer the geopandas skill; for celestial-sphere astronomy coordinates (ICRS/galactic, FITS, WCS) prefer the astropy skill. Part of the AlterLab Academic Skills suite.4license: MIT5---67# GeoMaster89Comprehensive geospatial science skill covering GIS, remote sensing, spatial analysis, and ML for Earth observation across 70+ topics with 500+ code examples in 8 programming languages.1011## Installation1213Pick ONE package manager for the GDAL-backed stack. Modern pip wheels for14rasterio/fiona/pyproj/shapely bundle their own GDAL/GEOS/PROJ, so a pure-pip15(uv) env covers the core libs without a system GDAL. Do NOT mix conda-GDAL16with pip rasterio/fiona in the same env — the two ship different GDAL binaries17and the ABI mismatch segfaults. The standalone `gdal` Python bindings do NOT18bundle binaries (they need a matching system/conda libgdal); PDAL and rsgislib19likewise have no reliable pip wheels — get those via conda (Option B).2021```bash22# Option A — uv/pip env (recommended here): wheels bundle GDAL/GEOS/PROJ.23# rasterio/fiona cover most GDAL needs; standalone `gdal` -> use Option B.24uv pip install rasterio fiona shapely pyproj geopandas25uv pip install torchgeo earthengine-api26uv pip install scikit-learn xgboost torch-geometric27uv pip install osmnx networkx folium keplergl28uv pip install cartopy contextily mapclassify29uv pip install xarray rioxarray dask-geopandas30uv pip install pystac-client planetary-computer odc-stac rio-cogeo31uv pip install laspy[lazrs] open3d # PDAL: use conda (no pip wheel)3233# Option B — conda env (best for PDAL / rsgislib / system GDAL tooling)34conda install -c conda-forge gdal rasterio fiona shapely pyproj geopandas \35 rsgislib pdal python-pdal postgis libspatialite36```3738## Quick Start3940### NDVI from Sentinel-24142```python43import rasterio44import numpy as np4546with rasterio.open('sentinel2.tif') as src:47 red = src.read(4).astype(float) # B0448 nir = src.read(8).astype(float) # B0849 ndvi = (nir - red) / (nir + red + 1e-8)50 ndvi = np.nan_to_num(ndvi, nan=0)5152 profile = src.profile53 profile.update(count=1, dtype=rasterio.float32)5455 with rasterio.open('ndvi.tif', 'w', **profile) as dst:56 dst.write(ndvi.astype(rasterio.float32), 1)57```5859### Spatial Analysis with GeoPandas6061```python62import geopandas as gpd6364# Load and ensure same CRS65zones = gpd.read_file('zones.geojson')66points = gpd.read_file('points.geojson')6768if zones.crs != points.crs:69 points = points.to_crs(zones.crs)7071# Spatial join and statistics72joined = gpd.sjoin(points, zones, how='inner', predicate='within')73stats = joined.groupby('zone_id').agg({74 'value': ['count', 'mean', 'std', 'min', 'max']75}).round(2)76```7778### Google Earth Engine Time Series7980```python81import ee82import pandas as pd8384ee.Initialize(project='your-project')85roi = ee.Geometry.Point([-122.4, 37.7]).buffer(10000)8687s2 = (ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')88 .filterBounds(roi)89 .filterDate('2020-01-01', '2023-12-31')90 .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)))9192def add_ndvi(img):93 return img.addBands(img.normalizedDifference(['B8', 'B4']).rename('NDVI'))9495s2_ndvi = s2.map(add_ndvi)9697def extract_series(image):98 stats = image.reduceRegion(ee.Reducer.mean(), roi.centroid(), scale=10, maxPixels=1e9)99 return ee.Feature(None, {'date': image.date().format('YYYY-MM-dd'), 'ndvi': stats.get('NDVI')})100101series = s2_ndvi.map(extract_series).getInfo()102df = pd.DataFrame([f['properties'] for f in series['features']])103df['date'] = pd.to_datetime(df['date'])104```105106## Core Concepts107108### Data Types109110| Type | Examples | Libraries |111|------|----------|-----------|112| Vector | Shapefile, GeoJSON, GeoPackage | GeoPandas, Fiona, GDAL |113| Raster | GeoTIFF, NetCDF, COG | Rasterio, Xarray, GDAL |114| Point Cloud | LAS, LAZ | Laspy, PDAL, Open3D |115116### Coordinate Systems117118- **EPSG:4326** (WGS 84) - Geographic, lat/lon, use for storage119- **EPSG:3857** (Web Mercator) - Web maps only (don't use for area/distance!)120- **EPSG:326xx/327xx** (UTM) - Metric calculations, <1% distortion per zone121- Use `gdf.estimate_utm_crs()` for automatic UTM detection122123```python124# Always check CRS before operations125assert gdf1.crs == gdf2.crs, "CRS mismatch!"126127# For area/distance calculations, use projected CRS128gdf_metric = gdf.to_crs(gdf.estimate_utm_crs())129area_sqm = gdf_metric.geometry.area130```131132### OGC Standards133134- **WMS**: Web Map Service - raster maps135- **WFS**: Web Feature Service - vector data136- **WCS**: Web Coverage Service - raster coverage137- **STAC**: Spatiotemporal Asset Catalog - modern metadata138139## Common Operations140141### Spectral Indices142143```python144def calculate_indices(image_path, bands=(2, 3, 4, 8, 11)):145 """NDVI, EVI, SAVI, NDWI from Sentinel-2.146147 `bands` maps (B02, B03, B04, B08, B11) to the 1-based band indices in148 your file. EVI's constants (6, 7.5, +1) assume surface reflectance in149 [0, 1]; raw L2A DN are scaled by 10000, so divide first or EVI is wrong.150 """151 with rasterio.open(image_path) as src:152 B02, B03, B04, B08, B11 = (src.read(b).astype(float) for b in bands)153154 ndvi = (B08 - B04) / (B08 + B04 + 1e-8)155 evi = 2.5 * (B08 - B04) / (B08 + 6*B04 - 7.5*B02 + 1 + 1e-8)156 savi = ((B08 - B04) / (B08 + B04 + 0.5)) * 1.5157 ndwi = (B03 - B08) / (B03 + B08 + 1e-8)158159 return {'NDVI': ndvi, 'EVI': evi, 'SAVI': savi, 'NDWI': ndwi}160```161162### Vector Operations163164```python165# Buffer (use projected CRS! 1000 = metres in UTM).166# Keep the result in the projected frame; don't bolt projected geometry167# back onto a geographic gdf or you silently mix CRS in one column.168gdf_proj = gdf.to_crs(gdf.estimate_utm_crs())169gdf_proj['buffer_1km'] = gdf_proj.geometry.buffer(1000)170171# Spatial relationships172intersects = gdf[gdf.geometry.intersects(other_geometry)]173contains = gdf[gdf.geometry.contains(point_geometry)]174175# Geometric operations176gdf['centroid'] = gdf.geometry.centroid177gdf['simplified'] = gdf.geometry.simplify(tolerance=0.001)178179# Overlay operations180intersection = gpd.overlay(gdf1, gdf2, how='intersection')181union = gpd.overlay(gdf1, gdf2, how='union')182```183184### Terrain Analysis185186```python187def terrain_metrics(dem_path):188 """Calculate slope, aspect, hillshade from DEM."""189 with rasterio.open(dem_path) as src:190 dem = src.read(1)191192 dy, dx = np.gradient(dem)193 slope = np.arctan(np.sqrt(dx**2 + dy**2)) * 180 / np.pi194 aspect = (90 - np.arctan2(-dy, dx) * 180 / np.pi) % 360195196 # Hillshade197 az_rad, alt_rad = np.radians(315), np.radians(45)198 hillshade = (np.sin(alt_rad) * np.sin(np.radians(slope)) +199 np.cos(alt_rad) * np.cos(np.radians(slope)) *200 np.cos(np.radians(aspect) - az_rad))201202 return slope, aspect, hillshade203```204205### Network Analysis206207```python208import osmnx as ox209import networkx as nx210211# Download and analyze street network212G = ox.graph_from_place('San Francisco, CA', network_type='drive')213G = ox.add_edge_speeds(G).add_edge_travel_times(G)214215# Shortest path216orig = ox.distance.nearest_nodes(G, -122.4, 37.7)217dest = ox.distance.nearest_nodes(G, -122.3, 37.8)218route = nx.shortest_path(G, orig, dest, weight='travel_time')219```220221## Image Classification222223```python224from sklearn.ensemble import RandomForestClassifier225import rasterio226from rasterio.features import rasterize227228def classify_imagery(raster_path, training_gdf, output_path):229 """Train RF and classify imagery."""230 with rasterio.open(raster_path) as src:231 image = src.read()232 profile = src.profile233 transform = src.transform234235 # Extract training data236 X_train, y_train = [], []237 for _, row in training_gdf.iterrows():238 mask = rasterize([(row.geometry, 1)],239 out_shape=(profile['height'], profile['width']),240 transform=transform, fill=0, dtype=np.uint8)241 pixels = image[:, mask > 0].T242 X_train.extend(pixels)243 y_train.extend([row['class_id']] * len(pixels))244245 # Train and predict246 rf = RandomForestClassifier(n_estimators=100, max_depth=20, n_jobs=-1)247 rf.fit(X_train, y_train)248249 prediction = rf.predict(image.reshape(image.shape[0], -1).T)250 prediction = prediction.reshape(profile['height'], profile['width'])251252 profile.update(dtype=rasterio.uint8, count=1)253 with rasterio.open(output_path, 'w', **profile) as dst:254 dst.write(prediction.astype(rasterio.uint8), 1)255256 return rf257```258259## Modern Cloud-Native Workflows260261### STAC + Planetary Computer262263```python264import pystac_client265import planetary_computer266import odc.stac267268# Search Sentinel-2 via STAC269catalog = pystac_client.Client.open(270 "https://planetarycomputer.microsoft.com/api/stac/v1",271 modifier=planetary_computer.sign_inplace,272)273274search = catalog.search(275 collections=["sentinel-2-l2a"],276 bbox=[-122.5, 37.7, -122.3, 37.9],277 datetime="2023-01-01/2023-12-31",278 query={"eo:cloud_cover": {"lt": 20}},279)280281# Load as xarray (cloud-native!)282# pystac-client >= 0.7: use search.items() (get_items() is deprecated).283items = list(search.items())[:5]284data = odc.stac.load(285 items,286 bands=["B02", "B03", "B04", "B08"],287 crs="EPSG:32610",288 resolution=10,289)290291# Calculate NDVI on xarray292ndvi = (data.B08 - data.B04) / (data.B08 + data.B04)293```294295### Cloud-Optimized GeoTIFF (COG)296297```python298import rasterio299from rasterio.session import AWSSession300301# Read COG directly from cloud (partial reads)302session = AWSSession(aws_access_key_id=..., aws_secret_access_key=...)303with rasterio.open('s3://bucket/path.tif', session=session) as src:304 # Read only window of interest305 window = ((1000, 2000), (1000, 2000))306 subset = src.read(1, window=window)307308# Write COG309with rasterio.open('output.tif', 'w', **profile,310 tiled=True, blockxsize=256, blockysize=256,311 compress='DEFLATE', predictor=2) as dst:312 dst.write(data)313314# Validate COG315from rio_cogeo.cogeo import cog_validate316cog_validate('output.tif')317```318319## Performance Tips320321```python322# 1. Spatial indexing (10-100x faster queries)323gdf.sindex # Auto-created by GeoPandas324325# 2. Chunk large rasters326with rasterio.open('large.tif') as src:327 for i, window in src.block_windows(1):328 block = src.read(1, window=window)329330# 3. Dask for big data (lazy, chunked, dask-backed DataArray)331import rioxarray332da_raster = rioxarray.open_rasterio('large.tif', chunks=(1, 1024, 1024))333# .data is the underlying dask.array if you need the raw chunked array:334# dask_array = da_raster.data335336# 4. Use Arrow for I/O337gdf.to_file('output.gpkg', use_arrow=True)338339# 5. GDAL caching340from osgeo import gdal341gdal.SetCacheMax(2**30) # 1GB cache342343# 6. Parallel processing344rf = RandomForestClassifier(n_jobs=-1) # All cores345```346347## Best Practices3483491. **Always check CRS** before spatial operations3502. **Use projected CRS** for area/distance calculations3513. **Validate geometries**: `gdf = gdf[gdf.is_valid]` (repair with `gdf.geometry.make_valid()`)3524. **Drop missing geometries**: `gdf = gdf[gdf.geometry.notna() & ~gdf.geometry.is_empty]` (`fillna(None)` does NOT work on a geometry column)3535. **Use efficient formats**: GeoPackage > Shapefile, Parquet for large data3546. **Apply cloud masking** to optical imagery3557. **Preserve lineage** for reproducible research3568. **Use appropriate resolution** for your analysis scale357358## Detailed Documentation359360- **[Coordinate Systems](references/coordinate-systems.md)** - CRS fundamentals, UTM, transformations361- **[Core Libraries](references/core-libraries.md)** - GDAL, Rasterio, GeoPandas, Shapely362- **[Remote Sensing](references/remote-sensing.md)** - Satellite missions, spectral indices, SAR363- **[Machine Learning](references/machine-learning.md)** - Deep learning, CNNs, GNNs for RS364- **[GIS Software](references/gis-software.md)** - QGIS, ArcGIS, GRASS integration365- **[Scientific Domains](references/scientific-domains.md)** - Marine, hydrology, agriculture, forestry366- **[Advanced GIS](references/advanced-gis.md)** - 3D GIS, spatiotemporal, topology367- **[Big Data](references/big-data.md)** - Distributed processing, GPU acceleration368- **[Industry Applications](references/industry-applications.md)** - Urban planning, disaster management369- **[Programming Languages](references/programming-languages.md)** - Python, R, Julia, JS, C++, Java, Go, Rust370- **[Data Sources](references/data-sources.md)** - Satellite catalogs, APIs371- **[Troubleshooting](references/troubleshooting.md)** - Common issues, debugging, error reference372- **[Code Examples](references/code-examples.md)** - 500+ examples373374---375376**GeoMaster covers everything from basic GIS operations to advanced remote sensing and machine learning.**