geo

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 2 Imported by: 0

README

go-geo

CircleCI GoDoc

Package geo provides functions of geographic functionality.

Documentation

Overview

Package geo provides functions of geographic functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(lat1, lng1, lat2, lng2 float64) float64

Distance calculates distance in miles between two lat/lng values.

func Distance32

func Distance32(lat1, lng1, lat2, lng2 float32) float32

Distance calculates distance in miles between two lat/lng values.

func ELng

func ELng(lng float64) float64

ELng converts lng to a full east longitude value [0, 360)

func ELng32

func ELng32(lng float32) float32

ELng converts lng to a full east longitude value [0, 360)

func EwLng

func EwLng(lng float64) float64

EwLng converts lng to a east/west longitude value [-180, 180)

func EwLng32

func EwLng32(lng float32) float32

EwLng converts lng to a east/west longitude value [-180, 180)

Types

type Poly

type Poly struct {
	Pts [](Pt)
}

Poly is a polygon represented by series of points. The lines of a polygon must be non-intersecting. Every simple polygon must begin and end with the same point. If a point is repeated, it is assumed to complete the polygon. A complex polygon with holesand/or islands is represented by sequential points representing complete simple polygons.

func (Poly) Contains

func (p Poly) Contains(point Pt) bool

Contains performs a point-in-polygon test.

type Pt

type Pt struct {
	Lat, Lng float32
}

Pt is a representation of a 2D point. float32 is used to save 50% of the space - as this can add up with large polygons.

type Pt64

type Pt64 struct {
	Lat, Lng float64
}

Jump to

Keyboard shortcuts

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