Distance between two devices
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
There is no such feature at the moment, but there were a few requests, so might add it in future.
Do you want i write a pull request ?
Best regard
Pull request are always welcome.
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.
I think it can be easily done on the front-end. There is no need to involve back-end.
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 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
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 ;)

@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 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 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.
Yes, i'm agree with you ;)
Do you want i close the issue ?
No, let people share use cases and discuss.
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.
There is already indication of scale.
@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?
It doesn't require configuration. It has been added in version 3.14.
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
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