traccar-web icon indicating copy to clipboard operation
traccar-web copied to clipboard

Distance between two devices

Open grosbedos opened this issue 8 years ago • 20 comments

Hi,

I would like to know if it is possible to add a feature, to calculate the distance between two devices ? It would be very handy for me,

I don't know if i must ask here, or in traccar-core..

Best regard

grosbedos avatar Aug 16 '17 13:08 grosbedos

There is no such feature at the moment, but there were a few requests, so might add it in future.

tananaev avatar Aug 16 '17 20:08 tananaev

Do you want i write a pull request ?

Best regard

grosbedos avatar Aug 17 '17 06:08 grosbedos

Pull request are always welcome.

tananaev avatar Aug 17 '17 06:08 tananaev

Should this done in backend or frontend, may be better to have it via API command to simplify any developers. Addition to this is that if someone wanted to integrate GIS route planning or google maps etc to get a better distance they could and it would be all server side.

tsmgeek avatar Aug 17 '17 12:08 tsmgeek

I think it can be easily done on the front-end. There is no need to involve back-end.

tananaev avatar Aug 17 '17 12:08 tananaev

Hi,

Sorry for my last comment, it's my wife that has respond, and she as made a little mistake ! "Pull request" and "Feature request" is not the same...

Unfortunately, I don't know anything about java, nor js :( I'm just a sysadmin, not a dev.. So i can't help to implement that :( I have try to read and understand how your traccar-web works, but no luck.. I was stay at php/drupal/symfony.. And that, i don't know how it's working ;)

Best regard

grosbedos avatar Aug 17 '17 13:08 grosbedos

@grosbedos Ive not done much distance calculation for quite a while, I do remember though that you have to take into account curvature of the earth to get a better calculation, over short distances a simple calculation will not give you much error but over large distances it could. Below was a snippet I found that can be used for this. Ive not tested it.

https://gist.github.com/stopsatgreen/4326804

tsmgeek avatar Aug 22 '17 16:08 tsmgeek

Hi,

Thanks for your help tsmgeek. I have successfully implement that in traccar, but it's very ugly. I have write all my (little) code on a view file (edit/Devices.js), but it's almost working. Not the first time when you load the webpage, but after the first automatic refresh...

Thanks a lot ;)

screenshot_56

grosbedos avatar Aug 29 '17 14:08 grosbedos

@grosbedos between which devices are you trying to calculate the distance? Between currently selected and all others? If you are deselecting device you should get "n/a" in all cells?

Abyss777 avatar Aug 30 '17 11:08 Abyss777

@Abyss777 Hi, no action possible, no option, i'm not a dev, so it's stupid/simple.. For every device (row), i verify if the device is in category animal, if yes, it's calculate the distance between the current animal device, and the first device of the category person. So i can track the distance between me and all my animals.

grosbedos avatar Aug 30 '17 11:08 grosbedos

@grosbedos I got your use case, but it is very special. Do not think it can be added to project as is, at least until it will be generalized somehow.

If somebody has general idea about distances between devices, please share.

Abyss777 avatar Aug 30 '17 13:08 Abyss777

Yes, i'm agree with you ;)

grosbedos avatar Aug 30 '17 13:08 grosbedos

Do you want i close the issue ?

grosbedos avatar Aug 30 '17 13:08 grosbedos

No, let people share use cases and discuss.

Abyss777 avatar Aug 30 '17 13:08 Abyss777

Just wanted to voice interest for the feature as well. I do like the setup where you select one device, either on the web interface or the app, and it gives the distance of all the other devices in relation to the selected one. Maybe even with an added compass direction, or an arrow to give rough indication.

If you're tracking objects or people in order to find them relative to your own position, that would be a very convenient setup.

In addition, it would be nice to have some indication of scale on maps, to help with orientation.

johnnychicago avatar Sep 12 '17 14:09 johnnychicago

There is already indication of scale.

tananaev avatar Sep 12 '17 19:09 tananaev

@tananaev I must've overlooked that. Version 3.12 here, I do not immediately see it on map, neither web nor Android. The i button on the map just shows the copyright notice for me.

Does scale require configuration options?

johnnychicago avatar Sep 13 '17 05:09 johnnychicago

It doesn't require configuration. It has been added in version 3.14.

tananaev avatar Sep 13 '17 05:09 tananaev

How about adding the ability to find the closest device to a geofenced area too ?

Just off the top of my head, this would allow you to send the closest vehicle to a regular destination (pickup or collection etc)

I'm not sure if this would be 'as the crow flies' or via routing

ScaredyCat avatar Aug 10 '22 15:08 ScaredyCat

I would suggest to add an option to display the distance between your current position and the position of the selected vehicle and get the itineary to reach it

Ykrm avatar May 11 '23 00:05 Ykrm