yingyan

package module
v0.0.0-...-d2a81be Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 11 Imported by: 0

README

yingyan.sdk

非官网 百度鹰眼Golang SDK V3 MIT License
前往 官方API文档

百度鹰眼

百度鹰眼是一套集轨迹追踪、存储、运算、查询的完整轨迹开放服务,可帮助开发者管理多达100万人/车轨迹。
使用百度鹰眼,您可以轻松开发出适用于车队监控、车联网、专车计费、外业人员监管、儿童防丢领域的轨迹管理产品。

完成进度

Entity
  • add
  • update
  • delete
  • list
  • search
  • boundsearch
  • aroundsearch
  • column
  • addcolumn
  • deletecolumn
  • listcolumn
Track
  • addpoint
  • addpoints
  • getlatestpoint
  • getdistance
  • gettrack
  • column
  • addcolumn
  • deletecolumn
  • listcolumn
Analysis
  • staypoint
  • drivingbehaviour

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bounds

type Bounds struct {
	Points []Point
}

func (*Bounds) ToData

func (b *Bounds) ToData() (string, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ak, sk string, serviceID int) *Client

visit http://lbsyun.baidu.com/apiconsole/key/ 获取ak 如果设置的白名单则设置sk ""

func (*Client) AddPoint

func (c *Client) AddPoint(pointData *PointData) (r *CommonResp, err error)

func (*Client) AddPoints

func (c *Client) AddPoints(pointDatas []*PointData) (r *CommonResp, err error)

func (*Client) EntityAdd

func (c *Client) EntityAdd(entityName, entityDesc string) (r *CommonResp, err error)

func (*Client) EntityBoundSearch

func (c *Client) EntityBoundSearch(bounds *Bounds, filter *EntityListFilter, coordType CoordType, pageIndex, pageSize int) (r *EntitiesListResp, err error)

根据矩形地理范围搜索entity,并返回实时位置

func (*Client) EntityDelete

func (c *Client) EntityDelete(entityName string) (r *CommonResp, err error)

func (*Client) EntityList

func (c *Client) EntityList(filter *EntityListFilter, coordType CoordType, pageIndex, pageSize int) (r *EntitiesListResp, err error)

func (*Client) EntityRoundSearch

func (c *Client) EntityRoundSearch(center Point, radius int, filter *EntityListFilter, coordType CoordType, pageIndex, pageSize int) (r *EntitiesListResp, err error)

func (*Client) EntitySearch

func (c *Client) EntitySearch(query string, filter *EntityListFilter, coordType CoordType, pageIndex, pageSize int) (r *EntitiesListResp, err error)

func (*Client) EntityUpdate

func (c *Client) EntityUpdate(entityName, entityDesc string) (r *CommonResp, err error)

func (*Client) Get

func (c *Client) Get(path string, param map[string]string) (body []byte, err error)

func (*Client) GetDistance

func (c *Client) GetDistance(entityName string, isProcessed bool, startTime, endTime int64, po *ProcessOption, supplementMode SupplementMode) (r *DistanceResp, err error)

func (*Client) GetLatestPoint

func (serv *Client) GetLatestPoint(entityName string, po *ProcessOption, coordType CoordType) (r *LatestPointResp, err error)

func (*Client) GetTrack

func (serv *Client) GetTrack(entityName string, isProcessed bool, startTime, endTime int64, po *ProcessOption, supplementMode SupplementMode, coordType CoordType, sortType SortType, pageIndex, pageSize int) (r *GetTrackResp, err error)

func (*Client) Post

func (c *Client) Post(path string, param map[string]string) (body []byte, err error)

func (*Client) SetHttpClient

func (c *Client) SetHttpClient(httpClient *http.Client)

SetHttpClient you can set your own http client

func (*Client) StayPoint

func (c *Client) StayPoint(entityName string, startTime, endTime, stayTime int64, po *ProcessOption, coordType CoordType) (r *StayPointResp, err error)

type CommonResp

type CommonResp struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

type CoordType

type CoordType string
var (
	GPSCoordType   CoordType = `wgs84`
	GcjCoordType   CoordType = `gcj02`
	BaiDuCoordType CoordType = `bd09ll`
)

type Denoise

type Denoise int
const (
	NotNeedDenoise Denoise = 0
	NeedDenoise    Denoise = 1
)

type DistanceResp

type DistanceResp struct {
	CommonResp
	Distance float64 `json:"distance"`
}

type EntitiesListResp

type EntitiesListResp struct {
	CommonResp
	Total    int           `json:"total"`
	Size     int64         `json:"size"`
	Entities []*EntityResp `json:"entities,omitempty"`
}

type EntityListFilter

type EntityListFilter struct {
	EntityNames  []string
	ActiveTime   int64 //该时间之后活跃的用户
	InactiveTime int64 //该时间之后不活跃的用户
}

func (*EntityListFilter) ToData

func (f *EntityListFilter) ToData() string

type EntityResp

type EntityResp struct {
	EntityName     string     `json:"entity_name"`
	EntityDesc     string     `json:"entity_desc"`
	ModifyTime     Time       `json:"modify_time"`
	CreateTime     Time       `json:"create_time"`
	LatestLocation *PointInfo `json:"latest_point,omitempty"`
}

type GetTrackResp

type GetTrackResp struct {
	CommonResp
	Total        int              `json:"total"`
	Size         int64            `json:"size"`
	Distance     float64          `json:"distance"`
	TollDistance float64          `json:"toll_distance"`
	StartPoint   *SimplePointInfo `json:"start_point,omitempty"`
	EndPoint     *SimplePointInfo `json:"end_point,omitempty"`
	Points       []*PointInfo     `json:"points,omitempty"`
}

type LatestPointResp

type LatestPointResp struct {
	CommonResp
	LatestPoint *PointInfo `json:"latest_point,omitempty"`
}

type MapMatch

type MapMatch int
const (
	NotNeedMapMatch MapMatch = 0
	NeedMapMatch    MapMatch = 1
)

type Point

type Point struct {
	Latitude  float64
	Longitude float64
}

type PointData

type PointData struct {
	EntityName string    `json:"entity_name"`
	Latitude   float64   `json:"latitude"`
	Longitude  float64   `json:"longitude"`
	LocTime    int64     `json:"loc_time"`
	CoordType  CoordType `json:"coord_type_input"` //坐标类型	 wgs84 GPS坐标 | gcj02 国测局加密坐标 | bd09ll 百度经纬度坐标
	Speed      float64   `json:"speed"`            //非必须
	Direction  int       `json:"direction"`        // 非必须 0 正北 顺时针
	Height     float64   `json:"height"`           // 非必须
	Radius     float64   `json:"radius"`           //非必须 定位精度,GPS或定位SDK返回的数值 定位精度,GPS或定位SDK返回的值
}

type PointInfo

type PointInfo struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	LocTime   int64   `json:"loc_time"`
	Direction int64   `json:"direction"`
	Speed     float64 `json:"speed"`
	Height    float64 `json:"height"`
	Floor     string  `json:"floor"`
}

type ProcessOption

type ProcessOption struct {
	Denoise         Denoise
	MapMatch        MapMatch
	RadiusThreshold int
	TransportMode   TransportMode
}

func (*ProcessOption) ToData

func (p *ProcessOption) ToData() string

type SimplePointInfo

type SimplePointInfo struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	LocTime   int64   `json:"loc_time,omitempty"`
	CoordType string  `json:"coord_type,omitempty"`
}

type SortType

type SortType string
var (
	DescSortType SortType = `desc`
	AscSortType  SortType = `asc`
)

type StayPoint

type StayPoint struct {
	StartTime int64            `json:"start_time"`
	EndTime   int64            `json:"end_time"`
	StayPoint *SimplePointInfo `json:"stay_point"`
}

type StayPointResp

type StayPointResp struct {
	CommonResp
	StaypointNum int          `json:"staypoint_num"`
	StayPoints   []*StayPoint `json:"stay_points,omitempty"`
}

type SupplementMode

type SupplementMode string
const (
	NoSupplement       SupplementMode = `no_supplement`
	StraightSupplement SupplementMode = `straight`
	DrivingSupplement  SupplementMode = `driving`
	RidingSupplement   SupplementMode = `riding`
	WalkingSupplement  SupplementMode = `walking`
)

type Time

type Time time.Time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

type TransportMode

type TransportMode string
const (
	DrivingTransportMode TransportMode = `driving`
	RidingTransportMode  TransportMode = `riding`
	WalkingTransportMode TransportMode = `walking`
)

Jump to

Keyboard shortcuts

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