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 ¶
- func Distance(a, b orb.Point, opts ...Option) unit.Length
- func IsZero(point orb.Point) bool
- func NormalizeAltitude(altitude unit.Length) unit.Length
- func PointAtBearingAndDistance(origin orb.Point, bearing bearings.Bearing, distance unit.Length, ...) orb.Point
- func TrueBearing(a, b orb.Point, opts ...Option) bearings.Bearing
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Distance ¶
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 NormalizeAltitude ¶
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 ¶
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. |