Accurate distance calculation
Using map projections to calculate real-world distances in meters or kilometers accurately.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill accurate-distance-calculationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.1 KB, 258 tokens by cl100k_base, as published. Nobody here has run it
Accurate Distance Calculation
Overview
Calculating distances in degrees (EPSG:4326) is incorrect because degrees represent different distances depending on the latitude. Always project to a metric system.
Choosing a Projection
- EPSG:4087: World Equidistant Cylindrical (Good for global distance approximation).
- UTM: Universal Transverse Mercator (Best for local, high-accuracy areas).
Conversion and Calculation
# Project to metric (meters)
METRIC_CRS = "EPSG:4087"
gdf_projected = gdf.to_crs(METRIC_CRS)
target_geom_projected = target_gdf.to_crs(METRIC_CRS).geometry.unary_union
# Calculate distance (returns meters)
gdf['distance_meters'] = gdf_projected.distance(target_geom_projected)
# Convert to Kilometers
gdf['distance_km'] = gdf['distance_meters'] / 1000.0
Finding Extremes
# Furthest point
furthest = gdf.nlargest(1, 'distance_km')
# Closest point
closest = gdf.nsmallest(1, 'distance_km')
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.