Thanks for this great module.
I got it - and the graphs - working but I'm wondering whether it is possible to display anything else then 'Altitude' / 'Distance'?

For instance, my tracks are almost always on flat terrain, and the altitude is not interesting. I would like however, to show the speed versus time displayed.

Any pointers where to look in the code maybe?
Also, I guess timestamps aren't always available in all formats?

Comments

askibinski’s picture

edit: I know it wouldn't be the actual recorded speed, but still if you know time and location (distance covered) one should be able to plot an average speed between every record, which should be quite accurate.

raintonr’s picture

Category: support » feature

If you used an input format that has more data, yes, it is possible to graph those values. For example, the TCX module knows about time, heart rate and cadence so you can graph them.

Look in the comments for _trackfield_graph_graphargs, they say:

  /*
   * Get arguments for passing to graph and graphdata functions.
   * These are encoded as arg(2)...
   * The URL is something like:
   * TRACKFIELD_GRAPH_PATH/graph/nid,vid,field[[,delta],[xset,yset]];...nid,vid,field[,delta]/size(/normalise)
   * or
   * TRACKFIELD_GRAPH_PATH/graphdata/nid,vid,field[,delta]
   * 
   * If more than one item is given, but nid,vid,field is ommitted the previous is assumed.
   * If delta is ommitted zero is assumed.
   * Eg.
   * TRACKFIELD_GRAPH_PATH/graph/nid,vid,field;,,,,distance,heartrate
   * Will graph distance/altitude (default) plus distance/heartrate
   */

You can use theme functions to display the correct path and URL. I didn't make any complicated options because the way graphs are laid out will be very dependant on themes so best left to individual site admins to choose.

If you want to plot speed then you'll have to calculate it. This would be done in trackfield_csv.module. Take a look at the bottom of there, the code says:


  /*
   * TODO: this should all be configurable.
   * Order is hardcoded for now as:
   * - Seconds
   * - Heartrate
   * - Cadence
   */
  if (count($ausr[0]) > 0) { $out['seconds'] = $ausr[0]; }
  if (count($ausr[1]) > 0) { $out['heartrate'] = $ausr[1]; }
  if (count($ausr[2]) > 0) { $out['cadence'] = $ausr[2]; }

So what you could do is modify this part so when 'seconds' is known you also create 'speed'.

It would be a nice feature, so have a crack and if you can create a patch then all the better.

askibinski’s picture

Priority: Normal » Minor

Thanks, I will check it out!