Skip to content

Position Data DTO Reference

The ThingsTelemetry\Traccar\Dto\PositionData represents a single Traccar position fix reported by a device.

php
use ThingsTelemetry\Traccar\Facades\Position;

$pos = Position::all(ids: [12345])->first(); // PositionData

Properties

PropertyTypeDescription
idintUnique position identifier.
deviceIdintThe device that produced this position.
protocolstringConnector/protocol name.
deviceTimeCarbonImmutableTimestamp when the device recorded the position.
fixTimeCarbonImmutableTimestamp of the GPS fix.
serverTimeCarbonImmutableTimestamp when the server stored the position.
validboolWhether the position is considered valid.
latitudefloatLatitude in decimal degrees.
longitudefloatLongitude in decimal degrees.
altitudefloatAltitude in meters.
speedfloatSpeed in knots.
coursefloatHeading/course in degrees.
addressstringResolved human-readable address.
accuracyfloatEstimated accuracy.
networkarray<string, mixed>Raw network-related information.
geofenceIdsarray<int, int>IDs of geofences related to this position.
attributesarray<string, mixed>Additional attributes returned by Traccar.

idinteger

Unique position identifier in Traccar.

php
$pos->id; // 12345

deviceIdinteger

The device that produced this position.

php
$pos->deviceId; // 42

protocolstring

Connector/protocol name that produced the position (e.g., osmand, teltonika).

php
$pos->protocol; // "osmand"

deviceTimeCarbonImmutable

Timestamp when the device recorded the position (ISO 8601).

php
$pos->deviceTime->toIso8601String(); // "2019-08-24T14:15:22Z"

fixTimeCarbonImmutable

Timestamp of the GPS fix (ISO 8601).

php
$pos->fixTime->toIso8601String(); // "2019-08-24T14:15:22Z"

serverTimeCarbonImmutable

Timestamp when the server stored the position (ISO 8601).

php
$pos->serverTime->toIso8601String(); // "2019-08-24T14:15:23Z"

validboolean

Indicates whether the position is considered valid by Traccar.

php
$pos->valid; // true

latitudefloat

Latitude in decimal degrees.

php
$pos->latitude; // -1.286389

longitudefloat

Longitude in decimal degrees.

php
$pos->longitude; // 36.817223

altitudefloat

Altitude in meters.

php
$pos->altitude; // 1679.3

speedfloat

Speed in knots as reported by Traccar.

php
$pos->speed; // 12.5 // knots

coursefloat

Heading/course in degrees (0–360).

php
$pos->course; // 275.0

addressstring

Resolved human-readable address, if reverse geocoding is enabled. Can be an empty string.

php
$pos->address; // "1600 Amphitheatre Pkwy, Mountain View, CA" or ""

accuracyfloat

Estimated accuracy (unit as provided by Traccar, typically meters).

php
$pos->accuracy; // 5.0

networkarray<string, mixed>

Raw network-related information associated with the position.

php
$pos->network; // [ 'cellTowers' => [...], 'wifiAccessPoints' => [...] ]

geofenceIdsarray<int, int>

IDs of geofences related to this position. Can be an empty array.

php
$pos->geofenceIds; // [3, 5] or []

attributesarray<string, mixed>

Additional attributes returned by Traccar for the position. May include vendor/device-specific keys. Can be empty.

php
$pos->attributes; // [ 'sat' => 12, 'battery' => 88, 'ignition' => true, ... ]

Notes

  • All fields are required on the DTO. When constructing via PositionData::fromArray(...), empty/invalid time strings are parsed safely and default to now().
  • address may be an empty string if reverse geocoding is disabled or not available.
  • geofenceIds may be an empty array if no geofences are associated.
  • attributes and network default to empty arrays when missing.

Released under the MIT License.