capturegraph.data.load.types.location
#
Location - Geographic coordinate container for CaptureGraph data.#
A simple dataclass for geographic coordinates (longitude, latitude, altitude) that loads from PLocation JSON files.
Example
import capturegraph.data as cg
# Direct loading from JSON
location = cg.Location.from_json({"longitude": -76.480, "latitude": 42.445, "altitude": 261.5})
print(location.longitude) # -76.480
print(location.latitude) # 42.445
print(location.altitude) # 261.5
# Vectorized access with List
sessions.location.latitude # → List of all latitudes
Notes
- PLocation JSON format:
{"longitude": float, "latitude": float, "altitude": float} - altitude is the elevation in meters above sea level
- longitude/latitude use WGS84 coordinate system (standard GPS coordinates)
Location
dataclass
#
A geographic location with longitude, latitude, and altitude.
Stores GPS coordinates captured by the CaptureGraph mobile app.
Attributes:
| Name | Type | Description |
|---|---|---|
longitude |
float
|
Longitude in degrees (-180 to 180), WGS84 coordinate system. |
latitude |
float
|
Latitude in degrees (-90 to 90), WGS84 coordinate system. |
altitude |
float
|
Altitude in meters above sea level. |
Example
Source code in capturegraph-lib/capturegraph/data/load/types/location.py
from_json(data)
classmethod
#
Create a Location from a PLocation JSON dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict
|
Dict with 'longitude', 'latitude', and 'altitude' keys. |
required |
Returns:
| Type | Description |
|---|---|
Location
|
Location instance with the coordinates. |
Example
Source code in capturegraph-lib/capturegraph/data/load/types/location.py
to_json()
#
Convert to PLocation JSON dict.
Returns:
| Type | Description |
|---|---|
dict
|
Dict with 'longitude', 'latitude', and 'altitude' keys. |