@mapeo/schema
Version:
JSON schema and flow types for Mapeo
190 lines (188 loc) • 6.14 kB
JSON
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://mapeo.world/schemas/observation.json",
"title": "Observation",
"description": "An observation is something that has been observed at a particular time and place. It is a subjective statement of 'I saw/heard this, here'",
"definitions": {
"position": {
"description": "Position details",
"type": "object",
"properties": {
"timestamp": {
"description": "Timestamp of when the current position was obtained",
"type": "number"
},
"mocked": {
"description": "`true` if the position was mocked",
"type": "boolean",
"default": false
},
"coords": {
"description": "Position details, should be self explanatory. Units in meters",
"type": "object",
"properties": {
"altitude": {
"type": "number"
},
"heading": {
"type": "number"
},
"longitude": {
"type": "number"
},
"speed": {
"type": "number"
},
"latitude": {
"type": "number"
},
"accuracy": {
"type": "number"
}
}
}
}
}
},
"type": "object",
"properties": {
"id": {
"description": "Unique value that identifies this element",
"type": "string"
},
"version": {
"description": "Unique value that identifies this particular version of this element",
"type": "string"
},
"created_at": {
"description": "RFC3339-formatted datetime of when the first version of the element was created",
"type": "string",
"format": "date-time"
},
"timestamp": {
"description": "RFC3339-formatted datetime of when this version of the element was created",
"type": "string",
"format": "date-time"
},
"userId": {
"description": "ID of the user who made this edit",
"type": "string"
},
"deviceId": {
"description": "ID of the device that made this edit",
"type": "string"
},
"type": {
"description": "Must be `observation`",
"type": "string",
"enum": ["observation"]
},
"links": {
"description": "Version ids of the previous document versions this one is replacing",
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"schemaVersion": {
"description": "Version of this schema. Should increment for breaking changes to the schema",
"type": "number",
"minimum": 1,
"enum": [4]
},
"lat": {
"description": "latitude of the observation",
"type": ["number", "null"],
"minimum": -90,
"maximum": 90
},
"lon": {
"description": "longitude of the observation",
"type": ["number", "null"],
"minimum": -180,
"maximum": 180
},
"metadata": {
"description": "Additional metadata associated with the observation (e.g. location precision, altitude, heading)",
"type": "object",
"properties": {
"position": {
"$ref": "#/definitions/position",
"description": "Details of the position recorded for the observation"
},
"lastSavedPosition": {
"$ref": "#/definitions/position",
"description": "Details of the last saved position when the observation was recorded - useful if position is not recorded"
},
"positionProvider": {
"description": "Details of the location providers that were available on the device when the observation was recorded",
"type": "object",
"properties": {
"gpsAvailable": {
"description": "Whether the user has enabled GPS for device location (this is not the same as whether location is turned on or off, this is a device setting whether to use just wifi and bluetooth or use GPS for location)",
"type": "boolean"
},
"passiveAvailable": {
"description": "Whether the device is configured to lookup location based on wifi and bluetooth networks",
"type": "boolean"
},
"locationServicesEnabled": {
"description": "Has the user enabled location services on the device (this is often turned off when the device is in airplane mode)",
"type": "boolean"
},
"networkAvailable": {
"description": "Whether the device can lookup location based on cell phone towers",
"type": "boolean"
}
}
},
"manualLocation": {
"description": "Whether location has been set manually",
"type": "boolean",
"default": false
}
},
"additionalProperties": true
},
"refs": {
"type": "array",
"description": "References to any nodes or ways that this observation is related to.",
"items": {
"type": "object",
"properties": {
"id": {
"description": "ID of the element that this observation references",
"type": "string"
}
},
"required": ["id"]
}
},
"attachments": {
"type": "array",
"description": "media or other data that are attached to this observation",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "unique ID that identifies the attachment"
},
"type": {
"type": "string",
"description": "string that describes the type of the attachment"
}
},
"required": ["id"]
}
},
"tags": {
"type": "object",
"description": "User-defined key-value pairs relevant to this observation",
"properties": {},
"additionalProperties": true
}
},
"required": ["id", "version", "created_at", "type", "schemaVersion"]
}