tile38 icon indicating copy to clipboard operation
tile38 copied to clipboard

Is it possible to send the Distance from the GeoFence

Open abhit011 opened this issue 6 years ago • 10 comments

Just want to know if I have created Hooks and I get the exit notifications like this

{'detect': 'exit', 'group': '5c5046da4ec8885ee87c9f15', 'fields': {'eventTime': 1547642987, 's': 54}, 'object': {'type': 'Point', 'coordinates': [78.05278222222222, 25.236991111111113]}, 'hook': 'geoId_17663', 'command': 'set', 'key': 'fleet', 'time': '2019-01-29T18:00:17.1238811+05:30', 'id': 'xxxxxx1'}

Will it be possible in case of 'detect': 'exit', I can also get 'distance': of exit point from the respective geofence ? The distance should be Haversine Distance

Abhit

abhit011 avatar Jan 31 '19 11:01 abhit011

That's not possible atm. Though I could see how it would be pretty useful.

tidwall avatar Jan 31 '19 19:01 tidwall

There could be a way, if I set hook with META and having fields with all the bounding box points, and when the respective detect:'exit' will occur I can calculate the Haversine at my received end

Abhi

abhit011 avatar Feb 01 '19 03:02 abhit011

Seems like a reasonable approach.

tidwall avatar Feb 02 '19 19:02 tidwall

Another thing {'detect': 'exit', 'group': '5c5046da4ec8885ee87c9f15', 'fields': {'eventTime': 1547642987, 's': 54}, 'object': {'type': 'Point', 'coordinates': [78.05278222222222, 25.236991111111113]}, 'hook': 'geoId_17663', 'command': 'set', 'key': 'fleet', 'time': '2019-01-29T18:00:17.1238811+05:30', 'id': 'xxxxxx1'}

Will it be possible to also send time in milliseconds too

Abhi

abhit011 avatar Feb 13 '19 07:02 abhit011

@tidwall is it possible ?

abhit011 avatar Feb 14 '19 12:02 abhit011

The time member contains enough information to get the milliseconds.

tidwall avatar Feb 14 '19 14:02 tidwall

I am not denying that it can't be converted.. I am just asking if we can convert into milliseconds we would save some bytes getting transferred via hooks because of time as string YYYY-MM-DD ... Format. And for every hooks recv there would be a complexity of O(N), where N is the length of time string, converting into milliseconds .. Though the complexity is minimal but if there are a million hooks and tens of million set points happen with in an hour, it will be helpful for the whole entropy of stack. It was a suggestion.

Abhi

abhit011 avatar Feb 14 '19 15:02 abhit011

I see what you mean. Yes, it would be fewer bytes and faster parsing. The change would need to be optional, in order to keep backward compatibility. I would consider this.

tidwall avatar Feb 14 '19 22:02 tidwall

@tidwall 👍 , any tentative timeline for the same, when I should expect the change ?

Abhi :wq

abhit011 avatar Feb 15 '19 05:02 abhit011

Unfortunately, I can’t say when I’d personally be able get around to this change. I’d accept a PR.

tidwall avatar Feb 15 '19 12:02 tidwall