Documentation
¶
Overview ¶
Package tlxy provides simple XY geometry helper functions; these are approximate and designed for our specific use cases.
Index ¶
- func ApproxDistance(lonCheck float64, p Point, s Point) float64
- func ApproxLonMeters(p Point) float64
- func Distance2d(p1, p2 Point) float64
- func Distance2dLength(line []Point) float64
- func DistanceHaversine(a, b Point) float64
- func EncodePolyline(coords []Point) []byte
- func Length2d(line []Point) float64
- func LengthHaversine(line []Point) float64
- func LineContains(a []Point, b []Point) bool
- func LineEquals(a []Point, b []Point) bool
- func LineFlatCoords(line []Point) []float64
- func LineRelativePositions(line []Point, points []Point) []float64
- func LineRelativePositionsFallback(line []Point) []float64
- func LineSimilarity(a []Point, b []Point) (float64, error)
- type Approx
- type BoundingBox
- type GeomCache
- type Line
- type LineM
- type Point
- func CutBetweenPoints(line []Point, from Point, to Point) []Point
- func CutBetweenPositions(line []Point, dists []float64, startDist float64, endDist float64) []Point
- func DecodePolyline(p string) ([]Point, error)
- func DecodePolylineBytes(p []byte) ([]Point, error)
- func LineClosestPoint(line []Point, point Point) (Point, int, float64)
- func SegmentClosestPoint(a, b, p Point) (Point, float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApproxLonMeters ¶
func Distance2d ¶
func Distance2dLength ¶
func DistanceHaversine ¶
func EncodePolyline ¶
func LengthHaversine ¶
LengthHaversine returns the Haversine approximate length of a line.
func LineContains ¶
func LineEquals ¶
func LineFlatCoords ¶
func LineRelativePositions ¶
LineRelativePositions finds the relative position of the closest point along the line for each point. TODO: use Haversine
func LineRelativePositionsFallback ¶
LineRelativePositionsFallback returns the relative position along the line for each point. TODO: use Haversine
Types ¶
type BoundingBox ¶
type BoundingBox struct { MinLon float64 `json:"min_lon"` MinLat float64 `json:"min_lat"` MaxLon float64 `json:"max_lon"` MaxLat float64 `json:"max_lat"` }
func ParseBbox ¶
func ParseBbox(v string) (BoundingBox, error)
func (*BoundingBox) Contains ¶
func (v *BoundingBox) Contains(pt Point) bool
type Point ¶
func CutBetweenPoints ¶
CutBetweenPoints attempts to cut a line based on the relative positions of two nearby points projected onto the line.
func CutBetweenPositions ¶
CutBetweenPositions is similar to CutBetweenPoints but takes absolute positions.
func DecodePolyline ¶
func DecodePolylineBytes ¶
func LineClosestPoint ¶
LineClosestPoint returns the point (and position) on line closest to point. Based on go-geom DistanceFromPointToLineString
func SegmentClosestPoint ¶
SegmentClosestPoint returns the point (and position) on AB closest to P.