• Hi,
    I am using the trackserver plugin. It is great! Please check the attached url for my question.

    I made some adjustments to the plugin, I changed the date format of the infobar to a one I prefer.

    Also I added a pop-up to the start and end of each track, containing timestamp information of that point(and more info later). I did this with the following code:

    if (do_markers === true || do_markers == ‘start’) {
    start_marker = new _this.Mapicon(start_latlng, { fillColor: start_marker_color }).bindPopup(timestamp).addTo(featuregroup);
    markers.push(start_marker);
    }
    if (do_markers === true || do_markers == ‘end’) {
    end_marker = new _this.Mapicon(end_latlng, {
    fillColor: end_marker_color, track_id: track_id}).bindPopup(timestamp).addTo(featuregroup).bringToBack()

    However, the variable of the timestamp is always the timestamp of the last point of the track now, the same that was visible on the infobar.

    I cannot find how I can transfer the timestamp information of the start point (from which array?) of the track into a variable.

    Can you please help?
    Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author tinuzz

    (@tinuzz)

    Hi,

    Good question. Unfortunately, it’s not easy to accomplish, because the information you are looking for (the timestamp of the first track point) is simply not available in the data on the web page.

    The metadata is only sent for the last trackpoint. See

    https://github.com/tinuzz/wp-plugin-trackserver/blob/master/trackserver.php#L3743

    for where the metadata is compiled, and

    https://github.com/tinuzz/wp-plugin-trackserver/blob/master/trackserver.php#L3626

    for where this function is called.

    Basically, the database results are evaluated row by row, and at the end, the metadata is collected from the last row only. If you need metadata for other trackpoints, the ‘send_as_polyline’ function needs to gather that information. Perhaps you can copy the ‘get_metadata’ function, adapt it for the first trackpoint, and call that from the loop in ‘send_as_polyline’.

    The reason for this is efficiency: the metadata for other trackpoints than the last one is seldomly needed, and sending timestamps for all trackpoints would make the dataset almost twice as big. However, the need for more metadata comes up every now and then, and I’m thinking about how to fix that, without sending a lot of unnecessary data for every track. Of course, that doesn’t help you at this time, I’m sorry about that.

    If you implement a solution, I’d be interested in how you do it.

    Best regards,
    Martijn.

    • This reply was modified 6 years, 9 months ago by tinuzz.
    • This reply was modified 6 years, 9 months ago by tinuzz.
    Thread Starter rgpvandervalk

    (@rgpvandervalk)

    Hi!
    Thank you for your reply! That was fast=). Unfortunatly it wasn’t as easy as I thought. The PHP file is a bit difficult for me, I have used several coding languages in the past, but the .js files are easier for me to understand somehow. Never used both although. So that would take me some more time.

    Anyway, maybe we can find a workaround. I was thinking if the filename of a track is available in the .js file? Or can be replace the <displayname> with the filename of the track in the php file. Because the filename of the track contains the starting date and time (and some formatting, but that is easy to solve). This is off course not a permanent solution, but might work for me now.

    Regards,
    Ramon

    Plugin Author tinuzz

    (@tinuzz)

    Hi Ramon,

    That would be doable. The name of the track is already present in the results from the database, it’s just not added to the metdata.

    After line 3750
    ( https://github.com/tinuzz/wp-plugin-trackserver/blob/master/trackserver.php#L3750 )
    add the following:

    'trackname' => $row['name'],

    Then, in trackserver.js, in the ‘process_data’ function
    ( https://github.com/tinuzz/wp-plugin-trackserver/blob/master/trackserver.js#L57 )
    you will have the track name available as o.metadata.trackname and you can do anything you want with it.

    I will add this in the next release, but it will take a while before I get back to Trackserver development.

    Let me know if this works for you.

    Best regards,
    Martijn.

    Thread Starter rgpvandervalk

    (@rgpvandervalk)

    Thank you alot for the help. It works and is already live! Later this month I will try to add some links to corresponding blog posts (and clickable photos maybe) as well in the pop-up window on the map.

    Do you maybe know why I get this error message when I try to save the edited trackserver.php in the plugin editor in wordpress?

    ‘Er is iets fout gegaan. Je wijziging is mogelijk niet opgeslagen. Probeer opnieuw. Er is een kans dat je dit handmatig moet repareren en het bestand uploaden via FTP. ‘

    I don’t get this message with other plugin’s.php files or even with the trackserver.js.

    So I had to edit the .php in .wordpad on my desktop and .zip it and install it again =(
    Have been searching already for a while on google for the solution.

    Hello:

    I have been using this plugin to track +100 fleet for several months now; I tough you might like to know that I implemented the popup with start/end markets datetime and total distance.

    Downside is that since I had to make changes to source code upgrading is not going to be easey (I am using 3.0.1).

    Great work!

    Mayte

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tracking information of markers’ is closed to new replies.