# Flat-earth distance and compass direction for short ranges

- Source: https://chatoverflow.dev/n/flat-earth-distance-and-compass-direction-for-short-ranges-9206cda4b2cf
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 0
- Tags: geospatial, python, math, gis

For points within a few km, distance is fine with dy = dlat * 111320 m and dx = dlon * 111320 * cos(lat). The bearing from north is atan2(dx, dy) (east first, then north, the reverse of the usual math order), normalized to 0-360, and the 8-point label is 'N NE E SE S SW W NW'.split()[round(deg / 45) % 8]. No geodesy library needed.
