# world.treeline.segment.record

> Published by [treeline.world](https://lexicon.garden/identity/did:plc:sjejpugpajgvxweilujzjcmq)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:sjejpugpajgvxweilujzjcmq/world.treeline.segment.record)
- [Documentation](https://lexicon.garden/lexicon/did:plc:sjejpugpajgvxweilujzjcmq/world.treeline.segment.record/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:sjejpugpajgvxweilujzjcmq/world.treeline.segment.record/examples)

## Definitions

### `world.treeline.segment.record#externalTrailIds`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `cotrexId` | `string` | No | COTREX trail feature identifier. |
| `osmRelationId` | `string` | No | OpenStreetMap relation identifier. |
| `osmWayId` | `string` | No | OpenStreetMap way identifier. |
| `usfsTrailNumber` | `string` | No | United States Forest Service trail identifier. |

### `world.treeline.segment.record#gradeStats`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `avgGradePct` | `string` | No | Mean gradient percentage (as a decimal string, e.g. '12.5'). |
| `climbCategory` | `string` | No | Standard climb category rating. |
| `maxGradePct` | `string` | No | Peak gradient percentage (as a decimal string, e.g. '18.2'). |

### `world.treeline.segment.record`

**Type**: `record`

A competitive trail timing segment with defined start/finish gates.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `createdAt` | `string` (datetime) | Yes | Segment creation timestamp. |
| `description` | `string` | No | Optional notes or description of the segment terrain. |
| `directionality` | `string` | Yes | Directionality of timing traversal. |
| `endGate` | `ref` → `#timingGate` | Yes | End timing gate coordinate and tolerance radius. |
| `geometry` | `ref` → `#simplifiedLineString` | Yes | Canonical polyline geometry for map matching. |
| `gradeStats` | `ref` → `#gradeStats` | No | Gradient statistics and climb category. |
| `physicalTrailRef` | `ref` → `#externalTrailIds` | No | Public authoritative trail registry cross-references (OSM, COTREX, USFS). |
| `segmentType` | `string` | Yes | Type or profile category of the segment. |
| `sourceActivityRef` | `ref` → `com.atproto.repo.strongRef` | No | Optional reference to the source activity from which the segment was extracted. |
| `sport` | `string` | Yes | Primary sport class for this segment (e.g. mountain_bike, trail_run). |
| `startGate` | `ref` → `#timingGate` | Yes | Start timing gate coordinate and tolerance radius. |
| `title` | `string` | Yes | Title or display name of the segment. |

### `world.treeline.segment.record#simplifiedLineString`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `coordinates` | `array` | Yes | Polyline coordinate tuples array. |
| `type` | `string` | Yes | GeoJSON LineString type. |

### `world.treeline.segment.record#timingGate`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `coordinate` | `unknown` | Yes | Timing gate coordinate tuple [lon, lat, ele?]. |
| `radiusMeters` | `integer` | No | Snapping radius in meters around the gate coordinate. |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "externalTrailIds": {
      "properties": {
        "cotrexId": {
          "description": "COTREX trail feature identifier.",
          "type": "string"
        },
        "osmRelationId": {
          "description": "OpenStreetMap relation identifier.",
          "type": "string"
        },
        "osmWayId": {
          "description": "OpenStreetMap way identifier.",
          "type": "string"
        },
        "usfsTrailNumber": {
          "description": "United States Forest Service trail identifier.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "gradeStats": {
      "properties": {
        "avgGradePct": {
          "description": "Mean gradient percentage (as a decimal string, e.g. '12.5').",
          "type": "string"
        },
        "climbCategory": {
          "description": "Standard climb category rating.",
          "knownValues": [
            "HC",
            "1",
            "2",
            "3",
            "4",
            "uncategorized"
          ],
          "type": "string"
        },
        "maxGradePct": {
          "description": "Peak gradient percentage (as a decimal string, e.g. '18.2').",
          "type": "string"
        }
      },
      "type": "object"
    },
    "main": {
      "description": "A competitive trail timing segment with defined start/finish gates.",
      "key": "tid",
      "record": {
        "properties": {
          "createdAt": {
            "description": "Segment creation timestamp.",
            "format": "datetime",
            "type": "string"
          },
          "description": {
            "description": "Optional notes or description of the segment terrain.",
            "maxGraphemes": 2000,
            "maxLength": 20000,
            "type": "string"
          },
          "directionality": {
            "default": "forward",
            "description": "Directionality of timing traversal.",
            "knownValues": [
              "forward",
              "reverse",
              "out_and_back"
            ],
            "type": "string"
          },
          "endGate": {
            "description": "End timing gate coordinate and tolerance radius.",
            "ref": "#timingGate",
            "type": "ref"
          },
          "geometry": {
            "description": "Canonical polyline geometry for map matching.",
            "ref": "#simplifiedLineString",
            "type": "ref"
          },
          "gradeStats": {
            "description": "Gradient statistics and climb category.",
            "ref": "#gradeStats",
            "type": "ref"
          },
          "physicalTrailRef": {
            "description": "Public authoritative trail registry cross-references (OSM, COTREX, USFS).",
            "ref": "#externalTrailIds",
            "type": "ref"
          },
          "segmentType": {
            "description": "Type or profile category of the segment.",
            "knownValues": [
              "climb",
              "descent",
              "sprint",
              "trail",
              "traverse"
            ],
            "type": "string"
          },
          "sourceActivityRef": {
            "description": "Optional reference to the source activity from which the segment was extracted.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "sport": {
            "description": "Primary sport class for this segment (e.g. mountain_bike, trail_run).",
            "type": "string"
          },
          "startGate": {
            "description": "Start timing gate coordinate and tolerance radius.",
            "ref": "#timingGate",
            "type": "ref"
          },
          "title": {
            "description": "Title or display name of the segment.",
            "maxGraphemes": 300,
            "maxLength": 3000,
            "type": "string"
          }
        },
        "required": [
          "title",
          "segmentType",
          "sport",
          "startGate",
          "endGate",
          "directionality",
          "geometry",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "simplifiedLineString": {
      "properties": {
        "coordinates": {
          "description": "Polyline coordinate tuples array.",
          "items": {
            "type": "unknown"
          },
          "maxLength": 500,
          "type": "array"
        },
        "type": {
          "const": "LineString",
          "description": "GeoJSON LineString type.",
          "type": "string"
        }
      },
      "required": [
        "type",
        "coordinates"
      ],
      "type": "object"
    },
    "timingGate": {
      "properties": {
        "coordinate": {
          "description": "Timing gate coordinate tuple [lon, lat, ele?].",
          "type": "unknown"
        },
        "radiusMeters": {
          "default": 25,
          "description": "Snapping radius in meters around the gate coordinate.",
          "maximum": 200,
          "minimum": 5,
          "type": "integer"
        }
      },
      "required": [
        "coordinate"
      ],
      "type": "object"
    }
  },
  "id": "world.treeline.segment.record",
  "lexicon": 1
}
```
