spatial

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 7 Imported by: 5

Documentation

Overview

Package spatial contains geospatial functions. It provides functions for working with the github.com/paulmach/orb, github.com/dharmab/bearings and github.com/martinlindhe/unit modules together.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(a, b orb.Point, opts ...Option) unit.Length

Distance returns the distance between two points on the Earth's surface. By default, this uses great-circle distance on a spherical Earth model.

When working with DCS World coordinates, use WithProjection to match DCS's internal coordinate system and improve accuracy at extreme latitudes.

func IsZero

func IsZero(point orb.Point) bool

IsZero returns true if the point is the origin.

func NormalizeAltitude

func NormalizeAltitude(altitude unit.Length) unit.Length

NormalizeAltitude returns the absolute length rounded to the nearest 1000 feet, or nearest 100 feet if less than 1000 feet.

func PointAtBearingAndDistance

func PointAtBearingAndDistance(origin orb.Point, bearing bearings.Bearing, distance unit.Length, opts ...Option) orb.Point

PointAtBearingAndDistance returns the point at the given bearing and distance from the origin. By default, this uses spherical Earth geometry.

When working with DCS World coordinates, use WithProjection to match DCS's internal coordinate system and improve accuracy at extreme latitudes.

func TrueBearing

func TrueBearing(a, b orb.Point, opts ...Option) bearings.Bearing

TrueBearing returns the true bearing from point a to point b. By default, this uses geodesic bearing on a spherical Earth model.

When working with DCS World coordinates, use WithProjection to match DCS's internal coordinate system and improve accuracy at extreme latitudes.

Types

type Option added in v1.8.0

type Option func(*options)

Option configures spatial calculations.

func WithProjection added in v1.8.0

func WithProjection(p projections.Projection) Option

WithProjection uses the given projection for calculations. When a projection is provided, distance and bearing calculations use planar geometry on the projected coordinate system instead of spherical geometry.

This improves accuracy when working with DCS World coordinates, which use Transverse Mercator projections internally.

Directories

Path Synopsis
Package projections provides map projections for converting between WGS84 geographic coordinates and flat projected coordinate systems.
Package projections provides map projections for converting between WGS84 geographic coordinates and flat projected coordinate systems.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL