Skip to content

Commit 513af55

Browse files
dshkolclaude
andcommitted
Fix area calculations and shapefile export in geometry tutorial
## Issues Fixed ### 1. Incorrect population density calculations - **Bug**: Area calculated in geographic CRS (degrees²) instead of projected CRS (m²) - **Result**: Nonsensical densities like 46 trillion people/km² - **Fix**: Reproject to EPSG:3347 before calculating areas - **Impact**: Now shows correct densities (Vancouver: 5,745 people/km²) ### 2. Shapefile export warnings - **Issue**: Column names > 10 chars truncated by shapefile format - **Issue**: Computed pop_density values too large for shapefile field width - **Fix**: - Export only base columns (geometry, name, v_CA21_1, v_CA21_434) - Rename to shapefile-friendly names (pop2021, income) - Changed from .to_excel() to .to_csv() for WKT export ### 3. Redundant CRS section - Removed duplicate CRS conversion code - Simplified to show CRS info and conversion examples - Added common Canadian CRS reference list ## Build Results - All geographic calculations now correct ✅ - No shapefile warnings about field width ✅ - Tutorial flow improved ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent adc798d commit 513af55

2 files changed

Lines changed: 79 additions & 28 deletions

File tree

0 commit comments

Comments
 (0)