Coordinates Type
The Coordinates type represents a geographic point using latitude and longitude coordinates.
Type Definition
"""
Represents a geographic point using latitude and longitude coordinates.
"""
type Coordinates {
"""
The latitude component of the coordinates in decimal degrees.
Positive values indicate North, negative values indicate South.
Range: -90 to 90
"""
latitude: Float
"""
The longitude component of the coordinates in decimal degrees.
Positive values indicate East, negative values indicate West.
Range: -180 to 180
"""
longitude: Float
}
Fields
| Field | Type | Description |
|---|---|---|
latitude | Float | Optional. Latitude in decimal degrees (-90 to 90) |
longitude | Float | Optional. Longitude in decimal degrees (-180 to 180) |
Example Query
query GetTrackerLocation {
tracker(id: "123") {
latestLocation {
location {
latitude
longitude
}
}
}
}
Validation
The API enforces the following validation rules for coordinates:
- Latitude Range
if latitude is not None and not -90 <= latitude <= 90:
raise ValueError("Latitude must be between -90 and 90 degrees")
- Longitude Range
if longitude is not None and not -180 <= longitude <= 180:
raise ValueError("Longitude must be between -180 and 180 degrees")
Best Practices
-
Precision
- Store coordinates with at least 6 decimal places
- Round displayed values based on accuracy needs
-
Validation
- Always validate coordinate ranges
- Handle missing coordinates gracefully
-
Performance
- Include only needed fields in queries
- Consider caching geocoded results