Introduction¶
Large language models often make calculation errors when handling spherical geometry problems, such as confusing the order of latitude and longitude, forgetting to convert between degrees and radians, or treating spherical polygons as planar figures. The dsh-geodesy plugin decouples these calculation routines from model inference and exposes them as deterministic local tools, providing accurate spherical geometry results.
Core Capabilities¶
This plugin provides seven core functions, all running locally with zero runtime dependencies:
- Great-circle distance: Calculates the distance between two points using the Haversine formula and returns the initial/final bearings as well as 16-point compass directions.
- Bearings and midpoint: Calculates the initial and final great-circle bearings between two points, as well as the midpoint of the great-circle path.
- Destination calculation: Calculates the destination point from a starting point, bearing, and distance, including round-trip distance validation.
- Coordinate parsing: Parses and validates coordinate strings (decimal degrees, DMS format, suffixes, coordinate pairs, etc.) and converts them to decimal degrees.
- Rhumb line calculation: Calculates the distance and heading for a loxodrome (compass rhumb line) and compares it with the great-circle distance.
- Path intersection: Calculates intersections between two great-circle paths, reporting the nearest intersection, the antipodal intersection, and the distance from the starting point.
- Spherical polygon area: Uses spherical excess (Girard’s theorem) to calculate the area and perimeter of a spherical polygon.
Installation¶
Before installing, ensure that pnpm is installed in the system environment and added to PATH.
Run the following command to install the plugin:
dsh plugin --profile web add github:TYEclipse/dsh-geodesy
After installation, restart the service for the corresponding profile (for example, dsh restart web).
Usage Examples¶
Ask DeepSeek Harness a question involving geometry on the Earth’s surface, and the model will automatically call the tools above.
Distance and bearing
“What is the great-circle distance from Beijing to Shanghai?”
Coordinate parsing
“Parse 37°46′30″N, 122°25′8.4″W into decimal degrees.”
Rhumb line and comparison
“How far do I sail from (45°N, 0°) to (45°N, 90°) at a constant heading, and how much longer is that than the great circle?”
Path intersection
“Where does the flight corridor starting at (0, 0) heading due east cross the one starting at (0, 90) heading due north?”
Spherical area
“What is the area of the triangle (0,0), (0,90), (90,0) on the sphere?”
Configuration and Notes¶
Earth radius
All calculations use the IUGG mean Earth radius of 6371.0088 km by default. This parameter can be adjusted in the plugin configuration, for example for lunar or planetary calculations.
Configuration example:
plugins:
dsh-geodesy:
radiusKm: 6371.0088
Input format
Coordinate input formats are strictly defined and support decimal degrees, DMS, suffixes (N/S/E/W), and coordinate pairs. Invalid input returns valid: false and the reason.
License
MIT.
Summary¶
tyeclipse/dsh-geodesy provides DeepSeek Harness with a complete local spherical geometry calculation solution suitable for scenarios that require precise geodetic calculations, avoiding the uncertainty introduced by model self-reasoning.
Catalog page: catalog_url
GitHub repository: github.com/TYEclipse/dsh-geodesy