Documentation ¶
Index ¶
- func InArea(geometry []Point, point Point) (bool, error)
- func InRangeLL(lat1 float64, lon1 float64, lat2 float64, lon2 float64, distance float64) (bool, error)
- type Point
- func (p *Point) GetDistance(other *Point) (float64, error)
- func (p *Point) InRange(other *Point, distance float64) (bool, error)
- func (p *Point) SetLatitude(latitude float64) error
- func (p *Point) SetLongitude(longitude float64) error
- func (p *Point) String() string
- func (p *Point) X() float64
- func (p *Point) Y() float64
- func (p *Point) Z() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InArea ¶
InArea will determine if a point exists in a geometry. The algorithm can be found here: https://www.eecs.umich.edu/courses/eecs380/HANDOUTS/PROJ2/InsidePoly.html
func InRangeLL ¶
func InRangeLL(lat1 float64, lon1 float64, lat2 float64, lon2 float64, distance float64) (bool, error)
InRangeLL accepts latitude and longitude values to create 2 points. The points are used to determine their range, then the range is used to determine if the distance is less than that range.
Types ¶
type Point ¶
type Point struct { // Latitude degrees for the world coordinates Latitude float64 `json:"latitude,omitempty" xml:"latitude"` // Longitude degrees for the world coordinates Longitude float64 `json:"longitude,omitempty" xml:"longitude"` // Altitude in meters above sea level. Negative values // are considered to be depth. Altitude float64 `json:"altitude,omitempty" xml:"altitude"` }
Point is a 3-Dimensional Point representation with fields for Latitude, Longitude, and Altitude
func Parse ¶
Parse will parse the point from the string formatted data containing the latitude, longitude, [optional] altitude. Strings with spaces are allowed but newlines and tabs should be avoided
func (*Point) GetDistance ¶
GetDistance will get the distance between two points using the Haversine function for coordinates on the earth. The returned distance is in meters.
func (*Point) InRange ¶
InRange will determine if this point is in range of another point. The range is provided as distance, and the units are assumed to be meters.
func (*Point) SetLatitude ¶
SetLatitude adds some protection to the ability to set the latitude degrees for the global coordinates
func (*Point) SetLongitude ¶
SetLongitude adds some protection to the ability to set the longitude degrees for the global coordinates