Documentation ¶
Index ¶
- func Distance(long1, lat1, long2, lat2 float64, key string) (distance float64, duration time.Duration, err error)
- func DrivingDistance(long1, lat1, long2, lat2 float64, strategy int, key string) (distance float64, duration time.Duration, tollsFee float64, err error)
- type DirectionResponse
- type DistanceResponse
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Distance ¶
func Distance(long1, lat1, long2, lat2 float64, key string) (distance float64, duration time.Duration, err error)
计算距离 返回中,distance单位是米
func DrivingDistance ¶
func DrivingDistance(long1, lat1, long2, lat2 float64, strategy int, key string) (distance float64, duration time.Duration, tollsFee float64, err error)
下方策略仅返回一条路径规划结果
0,速度优先,不考虑当时路况,此路线不一定距离最短 1,费用优先,不走收费路段,且耗时最少的路线 2,距离优先,不考虑路况,仅走距离最短的路线,但是可能存在穿越小路/小区的情况 3,速度优先,不走快速路,例如京通快速路(因为策略迭代,建议使用13) 4,躲避拥堵,但是可能会存在绕路的情况,耗时可能较长 5,多策略(同时使用速度优先、费用优先、距离优先三个策略计算路径)。
其中必须说明,就算使用三个策略算路,会根据路况不固定的返回一~三条路径规划信息。
6,速度优先,不走高速,但是不排除走其余收费路段 7,费用优先,不走高速且避免所有收费路段 8,躲避拥堵和收费,可能存在走高速的情况,并且考虑路况不走拥堵路线,但有可能存在绕路和时间较长 9,躲避拥堵和收费,不走高速
Types ¶
type DirectionResponse ¶
type DirectionResponse struct { Status string `json:"status" xml:"status"` Info string `json:"info" xml:"info"` Infocode string `json:"infocode" xml:"infocode"` Count string `json:"count" xml:"count"` Route struct { Origin string `json:"origin" xml:"origin"` Destination string `json:"destination" xml:"destination"` Paths []struct { Duration string `json:"duration" xml:"duration"` Strategy string `json:"strategy" xml:"strategy"` Tolls string `json:"tolls" xml:"tolls"` TollDistance string `json:"toll_distance" xml:"toll_distance"` Steps []struct { Tolls string `json:"tolls" xml:"tolls"` Duration string `json:"duration" xml:"duration"` Action jsoniter.RawMessage `json:"action" xml:"action"` Instruction string `json:"instruction" xml:"instruction"` Orientation string `json:"orientation" xml:"orientation"` Road string `json:"road,omitempty" xml:"road,omitempty"` Distance string `json:"distance" xml:"distance"` TollDistance string `json:"toll_distance" xml:"toll_distance"` TollRoad jsoniter.RawMessage `json:"toll_road" xml:"toll_road"` Polyline string `json:"polyline" xml:"polyline"` AssistantAction jsoniter.RawMessage `json:"assistant_action" xml:"assistant_action"` } `json:"steps" xml:"steps"` Restriction string `json:"restriction" xml:"restriction"` TrafficLights string `json:"traffic_lights" xml:"traffic_lights"` Distance string `json:"distance" xml:"distance"` } `json:"paths" xml:"paths"` } `json:"route" xml:"route"` }
type DistanceResponse ¶
type DistanceResponse struct { Status string `json:"status" xml:"status"` Info string `json:"info" xml:"info"` Infocode string `json:"infocode" xml:"infocode"` Results []struct { Distance string `json:"distance" xml:"distance"` Duration string `json:"duration" xml:"duration"` Info string `json:"info" xml:"info"` Code string `json:"code" xml:"code"` OriginID string `json:"origin_id" xml:"origin_id"` DestID string `json:"dest_id" xml:"dest_id"` } `json:"results" xml:"results"` }
type String ¶
type String []byte
func (String) MarshalJSON ¶
MarshalJSON returns m as the JSON encoding of m.
func (*String) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
Click to show internal directories.
Click to hide internal directories.