本文整理汇总了Golang中github.com/skypies/geo.Latlong.IsNil方法的典型用法代码示例。如果您正苦于以下问题:Golang Latlong.IsNil方法的具体用法?Golang Latlong.IsNil怎么用?Golang Latlong.IsNil使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/skypies/geo.Latlong
的用法示例。
在下文中一共展示了Latlong.IsNil方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetComplaintPositionsInSpanByIcao
// Leave icaoid as empty string to get all complaints; else limits to that aircraft
func (cdb ComplaintDB) GetComplaintPositionsInSpanByIcao(start, end time.Time, icaoid string) ([]geo.Latlong, error) {
ret := []geo.Latlong{}
q := datastore.
NewQuery(kComplaintKind).
Project("Profile.Lat", "Profile.Long").
Filter("Timestamp >= ", start).
Filter("Timestamp < ", end)
if icaoid != "" {
cdb.Infof("Oho, adding id2=%s", icaoid)
q = q.Filter("AircraftOverhead.Id2 = ", icaoid)
}
q = q.Limit(-1)
var data = []types.Complaint{}
if _, err := q.GetAll(cdb.Ctx(), &data); err != nil {
return ret, err
}
for _, c := range data {
// Round off the position data to a certain level of precision
lat, long := toFixed(c.Profile.Lat, 2), toFixed(c.Profile.Long, 2)
pos := geo.Latlong{Lat: lat, Long: long}
if !pos.IsNil() {
ret = append(ret, pos)
}
}
return ret, nil
}