Documentation ¶
Index ¶
- Constants
- Variables
- func AverageBearing(pts []LatLng) float64
- func AverageBearingZ(lles []LatLngEle) float64
- func Bearing(p1, p2 LatLng) float64
- func Coordinate(coord float64) string
- func Distance(p1, p2 LatLng) float64
- func EncodePolyline(lls []LatLng) string
- func EncodeZPolyline(lles []LatLngEle) string
- type Client
- type LatLng
- type LatLngEle
- type Polyline
- type ZPolyline
Constants ¶
const EARTH_RADIUS = 6371008.8 // m
const MAX_LOCATIONS_PER_REQUEST = 512
MAX_LOCATIONS_PER_REQUEST is the maximum number of 'lat,lng' pairs the Google Maps API allows in a single request.
Variables ¶
var AverageDirection = AverageBearing
AverageDirection is an alias for AverageBearing.
var AverageDirectionZ = AverageBearingZ
AverageDirection is an alias for AverageBearing.
var Centroid = Average
Centroid is an alias for Average.
var CentroidZ = AverageZ
CentroidZ is an alias for AverageZ.
var DEGREES_TO_RADIANS = math.Pi / 180.0
var Direction = Bearing
Direction is an alias for Bearing.
var GeographicMidpoint = Average
GeographicMidpoint is an alias for Average.
var GeographicMidpointZ = AverageZ
GeographicMidpointZ is an alias for AverageZ.
var GreatCircleDistance = Distance
GreatCircleDistance is an alias for Distance.
var HaversineDistance = Distance
HaversineDistance is an alias for Distance.
var RADIANS_TO_DEGREES = 180.0 / math.Pi
Functions ¶
func AverageBearing ¶
AverageBearing computes the mean bearing for the set of points pts. See: https://en.wikipedia.org/wiki/Mean_of_circular_quantities
func AverageBearingZ ¶
AverageBearingZ computes the mean bearing for the set of points pts.
func Bearing ¶
Bearing computes the bearing/direction to travel from p1 to p2 in degrees. See: http://www.movable-type.co.uk/scripts/latlong.html
func Coordinate ¶
func Distance ¶
Distance calculates the Haversine distance between two points in metres. See: http://www.movable-type.co.uk/scripts/latlong.html
func EncodePolyline ¶
EncodePolyline returns a new encoded Polyline from the given LatLng points.
func EncodeZPolyline ¶
EncodeZPolyline returns a new encoded ZPolyline from the given LatLngEle points.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client may be used to access methods which rely upon the Google Maps API.
type LatLng ¶
LatLng represents a 'latitude,longitude' pair.
func DecodePolyline ¶
DecodePolyline converts a polyline encoded string to an array of LatLng objects
func ParseLatLng ¶
ParseLatLng will parse a string representation of a 'lat,lng' pair.
func ParseLatLngs ¶
ParseLatLngs parses a string of | separated 'lat,lng' pairs.
type LatLngEle ¶
type LatLngEle struct { Lat float64 `json:"lat"` Lng float64 `json:"lng"` Ele float64 `json:"ele",omitempty` }
LatLngEle represents a 'latitude,longitude,elevation' triple.
func DecodeZPolyline ¶
DecodeZPolyline converts a z-polyline encoded string to an array of LatLngEle objects
func ParseLatLngEle ¶
ParseLatLngEle will parse a string representation of a 'lat,lng,ele' triples.
func ParseLatLngEles ¶
ParseLatLngEles parses a string of | separated 'lat,lng,ele' triples.
type Polyline ¶
type Polyline struct {
Points string `json:"points"`
}
Polyline represents a list of lat,lng points encoded as a byte array. See: https://developers.google.com/maps/documentation/utilities/polylinealgorithm