Timeline map (UK)

A modern 3D map with time slider, displays events over time on a UK map

Updated 7 years ago by Template retirement home

How to use this template

Event Map

WebGL-driven visualisation inspired by Kiln's shipmap.org. Displays events over time across a 3D map of the United Kingdom.

Data Requirements

The following spreadsheet columns should be used for your events:

  • latitude: the latitude of the event.
  • longitude: the longitude of the event.
  • start_timestamp: the start time of the event, as an ISO-8601 timestamp.
  • end_timestamp: the end time of the event, as an ISO-8601 timestamp (optional).
  • scale: the scale at which to draw the event. The domain defaults to 0 – 1, but you can specify a custom one in the template settings.
  • color: a categorical value to determine the color of the event. Colors are listed in the colors spreadsheet.

Colors are listed out in a separate spreadsheet with two columns:

  • category: the color name to use in your events spreadsheet.
  • color: the color value to use for this category. May take any of the following forms:
    • rgb(255, 255, 255)
    • rgb(10%, 20%, 30%)
    • rgba(255, 255, 255, 0.4)
    • rgba(10%, 20%, 30%, 0.4)
    • hsl(120, 50%, 20%)
    • hsla(120, 50%, 20%, 0.4)
    • #ffeeaa
    • #fea
    • steelblue (named colors, as specified here).

If a matching color isn't found in the spreadsheet, a fallback color will be used that you can customise in the template settings.

This section documents API usage specific to this template, so for an introduction we suggest you refer to the generic API documentation instead.

template: _147

version: _5

Template data

There are three different formats in which you can supply data to this template. The most convenient for you to use likely depends on the source of your data, as described below.

1. Array of arrays, and a bindings object

You can supply arrays of arrays to opts.data, which might look like:

{
    data: {
        colors: [
            [ "ColorsColumn1Value1", "ColorsColumn2Value1",
            [ "ColorsColumn1Value2", "ColorsColumn2Value2",
            [ "ColorsColumn1Value3", "ColorsColumn2Value3",
            ...
        ],
        events: [
            [ "EventsColumn1Value1", "EventsColumn2Value1",
            [ "EventsColumn1Value2", "EventsColumn2Value2",
            [ "EventsColumn1Value3", "EventsColumn2Value3",
            ...
        ]
    }
}

where each array of arrays represents the rows in a data sheet.

To tell the API how the values from each column should be associated with the keys that the template is expecting, you must also supply an object attached to opts.bindings. (The meanings of the keys in the bindings object are documented below.) The minimal bindings you can supply for this template are as shown in this example:

{
    template: "_147",
    version: "_5",
    bindings: {
        colors: {
            category: 0, // index of a column in your data
            color: 1, // index of a column in your data
        },
        events: {
            label: 0, // index of a column in your data
            lat: 1, // index of a column in your data
            lon: 2, // index of a column in your data
            start_timestamp: 3, // index of a column in your data
            end_timestamp: 4, // index of a column in your data
            color: 5, // index of a column in your data
            scale: 6, // index of a column in your data
        }
    },
    data: {
        colors: [
            [ "ColorsColumn1Value1", "ColorsColumn2Value1",
            [ "ColorsColumn1Value2", "ColorsColumn2Value2",
            [ "ColorsColumn1Value3", "ColorsColumn2Value3",
            ...
        ],
        events: [
            [ "EventsColumn1Value1", "EventsColumn2Value1",
            [ "EventsColumn1Value2", "EventsColumn2Value2",
            [ "EventsColumn1Value3", "EventsColumn2Value3",
            ...
        ]
    }
}

All possible bindings that you can supply are shown in this example:

{
    template: "_147",
    version: "_5",
    bindings: {
        colors: {
            category: 0, // index of a column in your data
            color: 1, // index of a column in your data
        },
        events: {
            label: 0, // index of a column in your data
            lat: 1, // index of a column in your data
            lon: 2, // index of a column in your data
            start_timestamp: 3, // index of a column in your data
            end_timestamp: 4, // index of a column in your data
            color: 5, // index of a column in your data
            scale: 6, // index of a column in your data
        }
    },
    data: {
        colors: [
            [ "ColorsColumn1Value1", "ColorsColumn2Value1",
            [ "ColorsColumn1Value2", "ColorsColumn2Value2",
            [ "ColorsColumn1Value3", "ColorsColumn2Value3",
            ...
        ],
        events: [
            [ "EventsColumn1Value1", "EventsColumn2Value1",
            [ "EventsColumn1Value2", "EventsColumn2Value2",
            [ "EventsColumn1Value3", "EventsColumn2Value3",
            ...
        ]
    }
}

2. Array of objects with arbitrary keys, and a bindings object

This format is most likely useful when you have data from an external source, such as CSV data loaded from d3-dsv. You should supply this attached to the opts.data, which might look like:

{
        colors: [
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            ...
        ],
        events: [
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            ...
        ]
    }

... but with the keys being the column headers from your source data instead. You must also supply an object attached to opts.bindings. The minimal bindings you can supply for this template are as shown in this example:

{
    template: "_147",
    version: "_5",
    bindings: {
        colors: {
            category: "ColorsHeader1",
            color: "ColorsHeader2",
        },
        events: {
            label: "EventsHeader1",
            lat: "EventsHeader2",
            lon: "EventsHeader3",
            start_timestamp: "EventsHeader4",
            end_timestamp: "EventsHeader5",
            color: "EventsHeader6",
            scale: "EventsHeader7",
        }
    },
    data: {
        colors: [
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            ...
        ],
        events: [
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            ...
        ]
    }
}

All possible bindings that you can supply are shown in this example:

{
    template: "_147",
    version: "_5",
    bindings: {
        colors: {
            category: "ColorsHeader1",
            color: "ColorsHeader2",
        },
        events: {
            label: "EventsHeader1",
            lat: "EventsHeader2",
            lon: "EventsHeader3",
            start_timestamp: "EventsHeader4",
            end_timestamp: "EventsHeader5",
            color: "EventsHeader6",
            scale: "EventsHeader7",
        }
    },
    data: {
        colors: [
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            { "ColorsHeader1": ..., "ColorsHeader2": ..., ... },
            ...
        ],
        events: [
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            { "EventsHeader1": ..., "EventsHeader2": ..., ... },
            ...
        ]
    }
}

(As before, the keys containing "Header" would be replaced by column names from your data source.)

3. Array of objects with template-defined keys

There is an alternative format you can use, which is likely to be easier to use if your data is not from a spreadsheet source. With this alternative format you supply your data to the template as an array of objects, attached to opts.data, where the keys must be those used by the template, as documented below. In this case there is no need to supply a bindings object, since the key names are already those expected by the template. The required properties in the data object are as follows (scroll down for a description of what each property is):

{
    template: "_147",
    version: "_5",
    data: {
    colors: [
        {
            category: ...,
            color: ...
        },
        ...
    ],
    events: [
        {
            label: ...,
            lat: ...,
            lon: ...,
            start_timestamp: ...,
            end_timestamp: ...,
            color: ...,
            scale: ...
        },
        ...
    ]
},
    ...
}

And the full list of all possible properties is as follows:

{
    template: "_147",
    version: "_5",
    data: {
    colors: [
        {
            category: ...,
            color: ...
        },
        ...
    ],
    events: [
        {
            label: ...,
            lat: ...,
            lon: ...,
            start_timestamp: ...,
            end_timestamp: ...,
            color: ...,
            scale: ...
        },
        ...
    ]
},
    ...
}

Meanings of the template data keys:

  • colors.category: The category name to be used from the events spreadsheet, which should match the categories you supply in the "color" column.
  • colors.color: The color to be used for this category.
  • events.label: A label to display when hovering over an event. Optional.
  • events.lat: The latitude coordinate for this event.
  • events.lon: The longitude coordinate for this event.
  • events.start_timestamp: the start time of the event, as a unix timestamp.
  • events.end_timestamp: the end time of the event, as a unix timestamp (optional).
  • events.color: A value between 0 and 1 used to determine the color of the event along a gradient (optional).
  • events.scale: A value between 0 and 1 used to determine the scale of the event (optional).

Template settings

Options for opts.state.

Environment

fog_density number

Fog Density.

fog_color color

Fog Color.

lighting_light1_color color

Light #1: Color.

lighting_light1_polar number

Light #1: Polar Angle.

Min: -90

Max: 90

lighting_light1_azimuth number

Light #1: Azimuth Angle.

Min: -180

Max: 180

lighting_light2_color color

Light #2: Color.

lighting_light2_polar number

Light #2: Polar Angle.

Min: -90

Max: 90

lighting_light2_azimuth number

Light #2: Azimuth Angle.

Min: -180

Max: 180

Time

timeline_playing boolean

Playing.

timeline_duration number

Timeline Duration.

Min: 5

timeline_speed number

Time Speed.

camera_transition_speed number

Camera Transition Duration. How long to spend moving the camera between slides in story mode, in seconds.

Events

events_pulse_enabled boolean

Enabled.

events_pulse_tooltips boolean

Enable Tooltips. Display a tooltip above the event when the user hovers over it.

events_pulse_on_ocean boolean

Display On Ocean.

events_pulse_date_format string

Date/Time Format. A date format string, as specified d3-time-format's `locale.format()` function. Defaults to ISO 8601.

events_pulse_scale number

Pulse Scale: Display Size. Changes the scale at which all pulses are displayed.

Max: 0.3

events_pulse_min_scale number

Pulse Scale: Domain Minimum.

events_pulse_max_scale number

Pulse Scale: Domain Maximum.

events_pulse_transition_duration number

Transition Duration.

Max: 5

events_pulse_fallback_color color

Fallback Color. Color to use for events when we can't find a category to use with them in the "colors" spreadsheet.

Terrain

mesh_terrain_enabled boolean

Enabled.

mesh_terrain_sharp_colors boolean

Sharp Colors.

mesh_terrain_color_ground color

Ground Color.

mesh_terrain_color_coast color

Coast Color.

mesh_terrain_color_cliff color

Cliff Color.

mesh_terrain_color_peak color

Peak Color.

mesh_terrain_enable_lighting boolean

Enable Lighting.

mesh_terrain_enable_noise boolean

Enable Noise.

Ocean

ocean_enabled boolean

Enabled.

ocean_color color

Water Color.

border_color color

Border Stroke Color.

border_thickness number

Border Stroke Thickness.

Min: -0.05

Max: 1