mirror of https://github.com/tidwall/tile38.git
distances on geofence, fixes #141
This commit is contained in:
parent
374d199d07
commit
d88f4594ac
|
@ -155,14 +155,19 @@ func fenceMatch(hookName string, sw *scanWriter, fence *liveFenceSwitches, metas
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
sw.mu.Lock()
|
sw.mu.Lock()
|
||||||
|
var distance float64
|
||||||
|
if fence.distance {
|
||||||
|
distance = details.obj.CalculatedPoint().DistanceTo(geojson.Position{X: fence.lon, Y: fence.lat, Z: 0})
|
||||||
|
}
|
||||||
sw.fmap = details.fmap
|
sw.fmap = details.fmap
|
||||||
sw.fullFields = true
|
sw.fullFields = true
|
||||||
sw.msg.OutputType = server.JSON
|
sw.msg.OutputType = server.JSON
|
||||||
sw.writeObject(ScanWriterParams{
|
sw.writeObject(ScanWriterParams{
|
||||||
id: details.id,
|
id: details.id,
|
||||||
o: details.obj,
|
o: details.obj,
|
||||||
fields: details.fields,
|
fields: details.fields,
|
||||||
noLock: true,
|
noLock: true,
|
||||||
|
distance: distance,
|
||||||
})
|
})
|
||||||
|
|
||||||
if sw.wr.Len() == 0 {
|
if sw.wr.Len() == 0 {
|
||||||
|
|
Loading…
Reference in New Issue