generic

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package generic gives a set of generic structs and functions for geodata manipulations. It is used to process geodata in a universal format, regardless of the source of this data.

Index

Constants

View Source
const (
	Proto      = "proto"
	Odometer   = "odometer"
	Satellites = "sats"
	HDOP       = "hdop"
	VDOP       = "vdop"
	PDOP       = "pdop"
	NavSystem  = "navsys"
	Move       = "move"
	DigInput   = "dinput"
	DigOutput  = "doutput"
	AnInput    = "ainput"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AxisWGS84

type AxisWGS84 struct {
	Coordinate float64
	Cardinal   CardinalAxis
}

AxisWGS84 is the WGS84 axis of a coordinate system.

func ParseAxisWGS84

func ParseAxisWGS84(coord string, c CardinalAxis) (AxisWGS84, error)

ParseAxisWGS84 parses a string into a AxisWGS84.

func (AxisWGS84) Float64

func (a AxisWGS84) Float64() float64

Float64 returns the floating point value of the coordinate. Example: 5544.6025;N 55 is a degree value. 44.6025 / 60 = 0,743375 is a minute value. N is north latitude (positive sign). 55 + 0,743375 = +55,743375 .

type CardinalAxis

type CardinalAxis string

CardinalAxis is the cardinal axis of a coordinate system.

const (
	North CardinalAxis = "N"
	South CardinalAxis = "S"
	East  CardinalAxis = "E"
	West  CardinalAxis = "W"
)

func ParseCardinalAxis

func ParseCardinalAxis(raw string) (cp CardinalAxis, err error)

ParseCardinalAxis parses a string into a CardinalAxis.

func (CardinalAxis) Sign

func (c CardinalAxis) Sign() float64

Sign returns the floating point sign of the coordinate.

type Cellular

type Cellular struct {
	// CellID - CID, CI - A GSM Cell ID
	CellID int64
	// LAC - Location Area Code
	LAC int64
	// MCC - Mobile Country Code
	MCC int64
	// MNC - Mobile Network Code
	MNC int64
}

Cellular is a generic cellular struct.

type Location

type Location struct {
	geom.Coordinates
	Valid bool
}

Location is a generic location struct.

type PointWGS84

type PointWGS84 struct {
	Lon, Lat AxisWGS84
	Valid    bool
}

PointWGS84 is the WGS84 point of a coordinate system.

func ParsePointWGS84

func ParsePointWGS84(lon string, cardLon CardinalAxis, lat string, cardLat CardinalAxis) (PointWGS84, error)

ParsePointWGS84 parses a pair string lon/lat into a PointWGS84.

func (PointWGS84) LocationXY

func (w PointWGS84) LocationXY() Location

LocationXY is the XY location of a coordinate system.

func (PointWGS84) LocationXYZ

func (w PointWGS84) LocationXYZ(z float64) Location

LocationXYZ is the XYZ location of a coordinate system.

type Position

type Position struct {
	Location
	Cellular   *Cellular
	Protocol   string
	DeviceID   string
	Attributes protocol.Attributes
	DeviceTime time.Time
	Speed      null.Float
	Course     null.Float
}

Position is a generic position struct.

func (Position) MarshalZerologObject

func (p Position) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog.LogObjectMarshaler.

Jump to

Keyboard shortcuts

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