The **Trip Layer** can animate an object as it traverses space and time. Both the object's model and its path can be highly configured, allowing for detailed visualizations.

The Trip Layer can be used for a variety of use-cases, [including fleet visualization.](https://docs.foursquare.com/analytics-products/docs/use-cases-fleet-visualization)

_The Trip Layer showing flights over France._

# GeoJSON Input  
GeoJSON data must contain `LineString` in its features' geometry. `LineString` must contain `[longitude, latitude, altitude, timestamp]`. Valid timestamp formats include unix in seconds such as `1564184363` or in milliseconds such as `1564184363000`.

### Example GeoJSON Input  
```json
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "vendor": "A"
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-74.20986, 40.81773, 0, 1564184363],
          [-74.20987, 40.81765, 0, 1564184396],
          [-74.20998, 40.81746, 0, 1564184409]
        ]
      }
    }
  ]
}
```

# CSV Input  
Columnar datasets (typically loaded from a CSV file) you must contain an `id`, `latitude`, `longitude`, `timestamp` column (an `altitude` column is optional). A path will be created by grouping the `id` column and sorting by the `timestamp` columns.

### Example CSV Input  
| id | latitude | longitude | timestamp |
| --- | --- | --- | --- |
| A | 40.81773 | -74.20986 | 1564184363 |
| A | 40.81765 | -74.20987 | 1564184396 |
| A | 40.81746 | -74.20998 | 1564184409 |
| B | 40.64375 | -74.33242 | 1565578213 |
| B | 40.64353 | -74.20987 | 1565578217 |
| B | 40.64222 | -74.33001 | 1565578243 |

# Settings  
The following sections detail every setting available in the Trip Layer.

## Basic  
Core settings for the Trip Layer.

| Setting | Description |
| --- | --- |
| Type | Must be "Trip" to use the Trip Layer. |
| Dataset | The dataset containing data for the trip layer. Either a [GeoJSON dataset](https://docs.foursquare.com/analytics-products/docs/layer-trip#geojson-as-input) or a [columnar dataset](https://docs.foursquare.com/analytics-products/docs/layer-trip#columnar-datasets-csv-as-input). |
| Columns | The columns of the selected dataset from which the Trip Layer's data is derived. Either a [GeoJSON](https://docs.foursquare.com/analytics-products/docs/layer-trip#geojson-as-input) column or [table columns](https://docs.foursquare.com/analytics-products/docs/layer-trip#columnar-datasets-csv-as-input) containing IDs, coordinates, timestamps, and optional altitude data. |

## Color  
| Setting | Description |
| --- | --- |
| Color Based On | A field to be used to calculate the color of the objects' trails. If no field is selected, you may choose a color to represent object trails. |
| Color Scale | The [color scale and palette](https://docs.foursquare.com/analytics-products/docs/layers-color-scale-and-palettes) of the layer. |
| Opacity | The opacity/transparency of the layer. |

## Stroke Width  
Stroke settings for the Trip Layer.

| Setting | Description |
| --- | --- |
| Stroke Width | The width of the moving objects' trails. |
| Billboard | Orients the stroke's geometry toward the viewport. |
| Stroke Based On | A field to base stroke width on. |
| Stroke Scale | The scale by which to grow strokes based on the attribute column. Choose from linear, sqrt, and log. |

## Trail Length  
Settings related to the trails of the moving objects.

| Setting | Description |
| --- | --- |
| Trail Length | The length of the moving objects' trails. |
| Fade Trail | When enabled, fade the objects' trails as time passes. |

## Label Settings  
Label settings for the Trip Layer. Labels appear affixed to the Trip Layer's moving objects.

| Setting | Description |
| --- | --- |
| Label Field | Select a field to display on the label. |
| Font Size | The size of the font to use on the label. |
| Font Color | The color of the label font. |
| Outline Width | The width of the outline in pixels. Set to `0` to disable the outline. |
| Outline Color | The color for the outline label. |
| Background Color | Toggle to enable a background color for the label. Choose a color with the color selector. |
| Text Anchor | Where, relative to the trip object, to anchor the text. Choose from start, middle, or end. |
| Alignment | How to align the text. Choose from top, middle, or bottom. |
| \+ Add More Labels | Add another label to the trip objects. |

## 3D Model Settings  
The following sections reiterate the [3D models documentation](https://docs.foursquare.com/analytics-products/docs/layers-3d), which also contains 3D model properties and settings.

| Field | Description |
| --- | --- |
| 3D Model | An optional 3D model displayed for each moving object. Select from our library of 3D models or select **Custom**, [then point to a link containing a .glb or .glTF file.](https://docs.foursquare.com/analytics-products/docs/layer-trip#custom-3d-models) |
| Apply Color | Apply a color of your choice or apply the trail's color to the 3D model. |
| Size Scale | Size is scaled by a factor of 2^x where x is the slider value. |
| Roll Based On | Set the model's roll (rotation on the X-axis) by choosing a field from the dataset or set it with the slider. |
| Pitch Based On | Set the model's pitch (rotation on the Y-axis) by choosing a field from the dataset or set it with the slider. |
| Yaw Based On | Set the model's yaw (rotation on the Z-axis) by choosing a field from the dataset or set it with the slider. |
