User Tools

Site Tools


custom-live-polling

Custom live polling service

The custom live polling service allows visualization of other user's positions using a custom webserver. The webserver implementation is not part of the Cartograph app.

The polling service regularly sends a HTTP request to the webserver which replies with a JSON reply containing the users' data.

Options

  • Enable service: If check then the service will regularly poll the webserver.
  • Service url: The address of the webserver.
  • Polling interval: The webserver polling interval in seconds. On mobile devices it is recommended to keep this value as high as possible to reduce energy usage.
  • Draw track: If checked then the movement track of users is drawn in addition to their current position.

URL parameters

The following parameters are available for custom polling services Service url:

  • {tf}: The start UTC timestamp in seconds from which measurements are requested.

Example: http://www.myserver.com/trackquery.php?tf={tf}

JSON data format

Cartograph expects a JSON formated reply on the polling request. Each user is a JSON array entry:

  • uid: A unique id for the user. This id has to be unique over the whole tracking session.
  • name: A name for the user which will be displayed in the Cartograph app.
  • type: The shape type drawn on the map. Can be either image or circle.
  • color: If the type is circle then the circle is filled with this color. The color should be in hexadecimal representation, for instance #FF0000 (red).
  • image: If the type is image then the URL stored in this field is used as the marker image in the map. For instance http://www.myserver.com/face_testuser.png.
  • pois: An array of tracking points for the user. Each tracking point can have the following fields:
    • time (required): The UTC timestamp of the measurement in seconds.
    • lat, lon (required): The position of the measurment in degrees.
    • alt: The altitude in meters.
    • hf: The heart frequency in beats per minute (BPM).
    • cad: The cadence in revolutions per minute.
[{"uid":1,
  "name":"Test User",
  "color":"#FF0000",
  "image":"",
  "type":"circle",
  "pois":[{"time":1452778503,"lat":44.26008234,"lon":13.1126239,"alt":243,"hf":0,"cad":0},
          {"time":1452778537,"lat":44.25987584,"lon":13.11270264,"alt":239,"hf":0,"cad":0},
          {"time":1452778576,"lat":44.25999101,"lon":13.11277382,"alt":237,"hf":0,"cad":0}
         ]
},
{"uid":2,
  "name":"Other User",
  "color":"#00FF00",
  "image":"",
  "type":"circle",
  "pois":[{"time":1452778703,"lat":44.27008234,"lon":13.1326239,"alt":443,"hf":0,"cad":0},
          {"time":1452778937,"lat":44.27987584,"lon":13.13270264,"alt":449,"hf":0,"cad":0},
          {"time":1452779576,"lat":44.27999101,"lon":13.13277382,"alt":447,"hf":0,"cad":0}
         ]
}]

If no tracking points are available for a user then an empty pois list has to be returned. If no entry is returned for a given user then it is assumed that the user has gone offline and it will be removed from the map view. The following JSON reply will for instance remove user “Other User” from the map but user “Test User” will remain on the map:

[{"uid":1,"name":"Test User","color":"#FF0000","image":"","type":"circle","pois":[[]]}]

If no users are online then an empty array must be retured. All eventually existing users will be removed from the map.

[]
custom-live-polling.txt · Last modified: 2016/01/24 08:19 by cartograph.eu