Adding custom friend tracking services

Starting with Cartograph 3.1.2 custom friend live tracking services are supported which allow you to view your friend’s location on the map via HTTP GET requests, for instance:

https://www.yourserver.com/examplecustomfriendservice

The following JSON code shows the expected friend data JSON response from our example service “https://www.cartograph.eu/v3/tools/examplecustomfriendservice“:

{
   "version":1,
   "error_code":0,
   "friends":[
      {
         "key":"friend_1",
         "name":"Kevin",
         "description":"Runner 1",
         "icon":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/1\/12\/User_icon_2.svg",
         "latitude":48.10000000000000142108547152020037174224853515625,
         "longitude":16.280000000000001136868377216160297393798828125,
         "time":"2022-02-26 10:26:57"
      },
      {
         "key":"friend_2",
         "name":"Anna",
         "description":"Runner 2",
         "icon":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/6c\/User_icon_3.svg",
         "latitude":48.00999999999999801048033987171947956085205078125,
         "longitude":16.17999999999999971578290569595992565155029296875,
         "time":"2022-02-26 10:26:57"
      },
      {
         "key":"friend_3",
         "name":"My dog",
         "description":"My best friend.",
         "icon":"",
         "latitude":48.21000000000000085265128291212022304534912109375,
         "longitude":16.25,
         "time":"2022-02-26 10:26:57"
      }
   ]
}

Starting with Cartograph Maps 3.1.3 also track points and viewing directions are supported:

{
   "version":2,
   "error_code":0,
   "friends":[
      {
         "key":"friend_1",
         "name":"Kevin",
         "description":"Runner 1",
         "icon":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/1\/12\/User_icon_2.svg",
         "latitude":48.10000000000000142108547152020037174224853515625,
         "longitude":16.280000000000001136868377216160297393798828125,
         "view_dir":34.11999999999999744204615126363933086395263671875,
         "time":"2022-03-05 06:51:41",
         "track_fg_color":"#ADD8E6",
         "track_bg_color":"#FFFFFF",
         "track_line_width":4,
         "trackpoints":[
            {
               "lat":48.4129999999999967030817060731351375579833984375,
               "lon":16.3900000000000005684341886080801486968994140625,
               "ts":1646459501
            },
            {
               "lat":48.4189999999999969304553815163671970367431640625,
               "lon":16.620999999999998664179656771011650562286376953125,
               "ts":1646459502
            }
         ]
      },
      {
         "key":"friend_2",
         "name":"Anna",
         "description":"Runner 2",
         "icon":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/6c\/User_icon_3.svg",
         "latitude":48.00999999999999801048033987171947956085205078125,
         "longitude":16.17999999999999971578290569595992565155029296875,
         "view_dir":120.0199999999999960209606797434389591217041015625,
         "time":"2022-03-05 06:51:41",
         "track_fg_color":"#972e17",
         "track_bg_color":"#FFFFFF",
         "track_line_width":4,
         "trackpoints":[
            {
               "lat":48.4849999999999994315658113919198513031005859375,
               "lon":16.14999999999999857891452847979962825775146484375,
               "ts":1646459501
            }
         ]
      },
      {
         "key":"friend_3",
         "name":"My dog",
         "description":"My best friend.",
         "icon":"",
         "latitude":48.21000000000000085265128291212022304534912109375,
         "longitude":16.25,
         "view_dir":0,
         "time":"2022-03-05 06:51:41"
      }
   ]
}

Note: To reduce transmission data and processing time, “trackpoints” should only contain all new track points since the last request.

Leave a Reply

Your email address will not be published. Required fields are marked *