Skip to content

Location Data Schema

Chris Scott edited this page Mar 1, 2017 · 2 revisions

Javascript Callback Schema

{
    "timestamp":     [Date],     // <-- Javascript Date instance
    "event":         [String],   // <-- motionchange|geofence|heartbeat|providerchange
    "is_moving":     [Boolean],  // <-- The motion-state when location was recorded.
    "uuid":          [String],   // <-- Universally unique identifier
    "odometer":      [Float],    // <-- Meters
    "mock":          [Boolean],  // <-- Present only when location came from a Mock provider
    "coords": {
        "latitude":  [Float],
        "longitude": [Float],
        "accuracy":  [Float],   // <-- Meters
        "speed":     [Float],   // <-- Meters; -1 when no valid value,
        "heading":   [Float],   // <-- Degrees 0-360; -1 when no valid value
        "altitude":  [Float],   // <-- Meters
        "altitude_accuracy: [Float], // <-- Meters; -1 when no valid value
    },
    "activity": {               
        "type": [String],       // <-- still|on_foot|walking|running|in_vehicle|on_bicycle|unknown,
        "confidence": [Integer] // <-- 0-100%
    },
    "battery": {
        "level": [Float]        // <-- 1=full; 0=empty
        "is_charging": [Boolean]
    }
}

HTTP POST Schema

The location-data schema POSTed to your server takes the following form:

{
    "location": {
        "timestamp":     [String],   // <-- ISO-8601
        "event":         [String],   // <-- motionchange|geofence|heartbeat|providerchange
        "is_moving":     [Boolean],  // <-- The motion-state when location was recorded.
        "uuid":          [String],   // <-- Universally unique identifier
        "odometer":      [Float],    // <-- Meters
        "mock":          [Boolean],  // <-- Present only when location came from a Mock provider
        "coords": {
            "latitude":   [Float],
            "longitude":  [Float],
            "accuracy":  [Float],   // <-- Meters
            "speed":     [Float],   // <-- Meters; -1 when no valid value,
            "heading":   [Float],   // <-- Degrees 0-360; -1 when no valid value
            "altitude":  [Float],   // <-- Meters
            "altitude_accuracy: [Float], // <-- Meters; -1 when no valid value
        },
        "extras": {   // <-- optional extras.  @see #getCurrentPosition for details
            "foo": "bar"
        },
        "activity": {
            "type": [still|on_foot|walking|running|in_vehicle|on_bicycle|unknown],
            "confidence": [Integer] <-- 0-100%
        },
        "geofence": {  // <-- Present only if a geofence was triggered at this location
            "identifier": [String],
            "action": [String ENTER|EXIT]            
        },
        "battery": {
            "level": [Float/0-1],
            "is_charging": [Boolean]
        },
        "provider": { //<-- Present only with providerchange event
            "enabled": [Boolean],
            "gps": [Boolean],
            "network": [Boolean],
            "status": [Integer]
        }
    }
}

Note: location is an array for batched requests

Clone this wiki locally