Can I make a map with stops and a tail for Santa Tracking?

Joystick3 years ago

Please disregard my comment about it not working on Safari, it is actually working as expected. Not sure what went wrong last night.
Would it be possible to add a .kml file with the route that Santa will take. Happy to sponsor the work. Please advise

Jason Bourne3 years ago

Anton, is there an easy way to take a list of street addresses, convert them into waypoints on the route or poly line, and import that into traccar?

I imagine we’ll have a lot of addresses to import and little time.

Anton Tananaev3 years ago

You can write a script and use something like Google Maps API to convert addresses to coordinates.

Bob Alooza3 years ago

This is great Anton! I have been using traccar for Santa runs for a couple years now, and this may take another level! Just to bump Pete's question, how do I layer a kml file on this so we can show the route before hand? I have set the POI on the user, but it does not load the overlay. Thanks so much!

Anton Tananaev3 years ago

It doesn't support KML, but you can create route with a geofence.

Bob Alooza3 years ago

That's unfortunate as we already have the kml routes built, would this be something achievable through professional services?

Anton Tananaev3 years ago

Yes, definitely.

Jason Bourne3 years ago

I'm have a small issue and I'm sure its that I'm not configuring this correctly. I created a new user and only associated that read only user with a single geofence (which is a polyline, with a number of points on the line). The token in the app.js is unique to the user who has only one polyline associated to the user.

The problem is when I go to the /santa/ folder that particular user is seeing all three geofences, not just the one I associated to the user.

How do I prevent one /santa/ folder from seeing all of the other poly lines in the database? I'm trying to create folders like this:

/zone1 - shows only zone1's geofence
/zone2 - shows only zone2's geofence

...and so on...

Anton Tananaev3 years ago

You are probably already logged in with another user.

Jason Bourne3 years ago

Anton, that is exactly what the problem was so thank you so much. But I think I've discovered another issue that may be related to being logged in. We have seven zones we're going to deliver to (two per night, over the course of four nights).

To support this I have copied the code into /zone1 through /zone7 subfolders. I created 7 read only users each with a unique token. I noticed that if I went to /zone1 it would bring up a polyline map, and then if I went to /zone2 or 3, 4, 5, 6, 7 etc. the same exact map showed up. I thought this was odd because I thought the app.js code was using the embedded token in app.js to get the right map.

What appears to be happening is when I go to /zone1/ I become "logged in" as the read-only user associated to that zone. The only way to make the map look right for zone2 is to go to the root of the website and choose Logout. This appears to clear any cached session I had and allows me to see the second zone -- but if I want to look at zone3 I have to logout again.

Is there a way to overcome this? I am pretty confident that parents using this to track santa are going to click on the wrong zone, or intentionally go look at another zone, and whatever zone they logged into first will keep prevailing because they won't know to logout. I can provide access to the system I built if you'd like to poke around it.

Anton Tananaev3 years ago

You need to logout every time. Alternatively you can open in a incognito browser mode and it will log you out automatically once you close the tab.

Jason Bourne3 years ago

@Anton Thank you for pointing that out. It had me wondering if this is something that could be done in the app.js - but not being very familiar with the code I have to ask. It appears in app.js you create loginUser() which fetches a URL with the token defined at the top of app.js.

Is it possible to create a logoutUser() and run that at the top of app.js, or make logging out of a previous session the first thing loginUser() does?

We do our deliveries Monday-Thursday this week so we're just going to do our best to encourage people to pick the proper route since logging out wouldn't be intuitive to a parent at home with the kids. I'm just thinking long term for improvement to so if someone picks the wrong route and then tries to go to the right route they're not locked into that previous selection.

Thank you again for this effort. Had traccar not existed I'm not sure how we would do this for 2021.

Anton Tananaev3 years ago

I decided to change the backend logic and force override session when token is used:

https://github.com/traccar/traccar/commit/f910e56a45a4adc08287b6674d011bd25ea52b27

You can compile a new Traccar version from the source code and it should solve the problem.

Jason Bourne3 years ago

I've been testing this in a Linux based lab of my own and could easily compile it for myself, but the city decided to spin up a Windows VM for this. Any chance you can make a windows binary? Sorry to be such a pain.

Anton Tananaev3 years ago

Binary is the same for Windows and Linux, so you can use the one from Linux.