examples/taxi/app.js
function updateTaxis()
{
    var ids = [ "11", "22", "33" ];
    var statuses = [ "avail", "busy", "scheduled" ];
    var bbox = bkutils.geoBoundingBox(center[0], center[1], 2); // within 2 km from the center
    var latitude = lib.randomNum(bbox[0], bbox[2], 5);
    var longitude = lib.randomNum(bbox[1], bbox[3], 5);
    var id = ids[lib.randomInt(0, ids.length - 1)];
    var status = statuses[lib.randomInt(0, statuses.length - 1)];

    db.put("taxi", { id: id, status: status, latitude: latitude, longitude: longitude });
}
function updateTaxis()
{
    var ids = [ "11", "22", "33" ];
    var statuses = [ "avail", "busy", "scheduled" ];
    var bbox = bkutils.geoBoundingBox(center[0], center[1], 2); // within 2 km from the center
    var latitude = lib.randomNum(bbox[0], bbox[2], 5);
    var longitude = lib.randomNum(bbox[1], bbox[3], 5);
    var id = ids[lib.randomInt(0, ids.length - 1)];
    var status = statuses[lib.randomInt(0, statuses.length - 1)];

    db.put("taxi", { id: id, status: status, latitude: latitude, longitude: longitude });
}
function updateTaxis ( ) { var ids = [ "11" , "22" , "33" ] ; var statuses = [ "avail" , "busy" , "scheduled" ] ; var bbox = bkutils . geoBoundingBox ( center [ 0 ] , center [ 1 ] , 2 ) ; // within 2 km from the center var latitude = lib . randomNum ( bbox [ 0 ] , bbox [ 2 ] , 5 ) ; var longitude = lib . randomNum ( bbox [ 1 ] , bbox [ 3 ] , 5 ) ; var id = ids [ lib . randomInt ( 0 , ids . length - 1 ) ] ; var status = statuses [ lib . randomInt ( 0 , statuses . length - 1 ) ] ; db . put ( "taxi" , { id : id , status : status , latitude : latitude , longitude : longitude } ) ; }
Simulate taxi location changes
Simulate taxi location changes