Arc map

Displays connections between pairs of points on a world map.

Updated 6 years ago by Template retirement home

How to use this template

What's it for?

Use this template to visualise flows between locations, or journeys.

How to get started

  1. You'll need two CSV or Excel files. One will contain the locations of the points shown on your map - the start and end points of your arcs. The other will contain the details of the arcs themselves.

  2. The locations file will need (at a minimum) columns for the location identifier, latitude and longitude. Here's an example:

    airport_id latitude longitude
    1 -6.081689835 145.3919983
    2 -5.207079887 145.7890015
    3 -5.826789856 144.2960052
  3. The arcs file will need (at a minimum) columns for the source ID and target ID of the arc. You can also include columns that can be used to specify the colour or thickness of the arc. Here's an example:

    source_id target_id airline
    1 2 American Airlines
    2 3 American Airlines
    1 3 United Airlines

Not sure how to upload your data to Flourish? See our handy guide

FAQ

How do I reset the initial zoom and centre of the map? For the moment, you need to do this: (1) Create a story from your visualisation (2) Zoom and pan the slide to adjust the zoom and centre of the map (3) In the left-hand menu, under "Navigation", choose "None" (4) Publish the story.

How do I change the colour of the arcs? Two methods. If you'd like them all to be the same colour, use the settings in the settings panel. If you'd like the colours to vary with some property of the data, select a "Category" column in the data panel. Then return to the settings panel and choose the Categorical colour option.

How do I change the thickness of the arcs? Two methods. If you'd like to make all the arcs thicker or thinner, just use the "Thickness" setting to do so. If you'd like the thickness to vary with some property of the data, select a "Value" column in the data panel. Then return to the settings panel and choose the Categorical colour option.

How can I highlight different points on the map? Create a story from your visualisation, then add multiple slides to highlight different views of the data. See the example story below.

Examples

Credits

Created by the Flourish team, using deck.gl and Mapbox GL JS. Want to see additional features? Let us know at support@flourish.studio.

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

template: _772

version: _8

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: {
        locations: [
            [ "LocationsColumn1Value1", "LocationsColumn2Value1",
            [ "LocationsColumn1Value2", "LocationsColumn2Value2",
            [ "LocationsColumn1Value3", "LocationsColumn2Value3",
            ...
        ],
        routes: [
            [ "RoutesColumn1Value1", "RoutesColumn2Value1",
            [ "RoutesColumn1Value2", "RoutesColumn2Value2",
            [ "RoutesColumn1Value3", "RoutesColumn2Value3",
            ...
        ]
    }
}

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: "_772",
    version: "_8",
    bindings: {
        locations: {
            id: 0, // index of a column in your data
            latitude: 1, // index of a column in your data
            longitude: 2, // index of a column in your data
        },
        routes: {
            source: 0, // index of a column in your data
            target: 1, // index of a column in your data
        }
    },
    data: {
        locations: [
            [ "LocationsColumn1Value1", "LocationsColumn2Value1",
            [ "LocationsColumn1Value2", "LocationsColumn2Value2",
            [ "LocationsColumn1Value3", "LocationsColumn2Value3",
            ...
        ],
        routes: [
            [ "RoutesColumn1Value1", "RoutesColumn2Value1",
            [ "RoutesColumn1Value2", "RoutesColumn2Value2",
            [ "RoutesColumn1Value3", "RoutesColumn2Value3",
            ...
        ]
    }
}

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

{
    template: "_772",
    version: "_8",
    bindings: {
        locations: {
            id: 0, // index of a column in your data
            latitude: 1, // index of a column in your data
            longitude: 2, // index of a column in your data
            category: 3, // index of a column in your data
        },
        routes: {
            source: 0, // index of a column in your data
            target: 1, // index of a column in your data
            width: 2, // index of a column in your data
            category: 3, // index of a column in your data
        }
    },
    data: {
        locations: [
            [ "LocationsColumn1Value1", "LocationsColumn2Value1",
            [ "LocationsColumn1Value2", "LocationsColumn2Value2",
            [ "LocationsColumn1Value3", "LocationsColumn2Value3",
            ...
        ],
        routes: [
            [ "RoutesColumn1Value1", "RoutesColumn2Value1",
            [ "RoutesColumn1Value2", "RoutesColumn2Value2",
            [ "RoutesColumn1Value3", "RoutesColumn2Value3",
            ...
        ]
    }
}

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:

{
        locations: [
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            ...
        ],
        routes: [
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            ...
        ]
    }

... 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: "_772",
    version: "_8",
    bindings: {
        locations: {
            id: "LocationsHeader1",
            latitude: "LocationsHeader2",
            longitude: "LocationsHeader3",
        },
        routes: {
            source: "RoutesHeader1",
            target: "RoutesHeader2",
        }
    },
    data: {
        locations: [
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            ...
        ],
        routes: [
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            ...
        ]
    }
}

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

{
    template: "_772",
    version: "_8",
    bindings: {
        locations: {
            id: "LocationsHeader1",
            latitude: "LocationsHeader2",
            longitude: "LocationsHeader3",
            category: "LocationsHeader4",
        },
        routes: {
            source: "RoutesHeader1",
            target: "RoutesHeader2",
            width: "RoutesHeader3",
            category: "RoutesHeader4",
        }
    },
    data: {
        locations: [
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            { "LocationsHeader1": ..., "LocationsHeader2": ..., ... },
            ...
        ],
        routes: [
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            { "RoutesHeader1": ..., "RoutesHeader2": ..., ... },
            ...
        ]
    }
}

(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: "_772",
    version: "_8",
    data: {
    locations: [
        {
            id: ...,
            latitude: ...,
            longitude: ...
        },
        ...
    ],
    routes: [
        {
            source: ...,
            target: ...
        },
        ...
    ]
},
    ...
}

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

{
    template: "_772",
    version: "_8",
    data: {
    locations: [
        {
            id: ...,
            latitude: ...,
            longitude: ...,
            category: ...
        },
        ...
    ],
    routes: [
        {
            source: ...,
            target: ...,
            width: ...,
            category: ...
        },
        ...
    ]
},
    ...
}

Meanings of the template data keys:

  • locations.id: The column containing the location code. Should match the codes used in the Arcs sheet.
  • locations.latitude: latitude
  • locations.longitude: longitude
  • locations.category: Optionally, a column containing the category of the arc, which can be used to specify its colour.
  • routes.source: The column containing the code for the arc's source. This should match the codes used in the Locations sheet
  • routes.target: The column containing the code for the arc's target, This should match the codes used in the Locations sheet
  • routes.width: Optionally, a column containing a value for the arc, which can be used to specify its thickness.
  • routes.category: Optionally, a column containing a category for the arc, which can be used to specify its colour. Over-rides the category in the Locations sheet, if both are specified.

Template settings

Options for opts.state.

Arcs

arc.arc_thickness number

Thickness.

arc.brushing_enabled boolean

Brushing enabled.

arc.brushing_brush_source boolean

Brush source.

arc.brushing_brush_target boolean

Brush target.

arc.brushing_brush_radius number

Brush radius (meters).

arc.arc_palette_enabled boolean

Type.

Allowed values:

  • false (Basic)
  • true (Categorical)

arc.arc_source_color color

Source colour.

arc.arc_source_opacity number

Source opacity.

Max: 1

arc.arc_target_color color

Target colour.

arc.arc_target_opacity number

Target opacity.

Max: 1

arc.arc_palette.palette colors

Palette.

arc.arc_palette.extend boolean

Auto-extend. Automatically generate additional colours when needed to avoid the palette colours being used more than once. Added colours are based on the average lightness and chroma values of the palette. This works best if the palette’s colours do not have very high or low saturation.

arc.arc_palette.advanced boolean

Fine tune. Fine tune how additional colours are added to the palette.

arc.arc_palette.hue_rotation_angle number

Hue rotation for added colours. Angle, in degrees in HCL colourspace, between one generated colour and the next. The default value, ~360/(Golden ratio), ensures adjacent hues are not too similar.

Max: 360

arc.arc_palette.custom_palette text

Custom overrides. Type the name of the entity whose colour you want to set, a colon and then a colour (using a name, hex-code or rgb declaration). Multiple colours can be set using multiple lines. For example:


Party 1: red
Party 2: #4455AA
Party 3: rgb(30,168,26)

Map

map.style_base string

Map style.

Allowed values:

  • dark-matter (Dark Matter)
  • positron (Positron)
  • osm-bright (OSM Bright)
  • klokantech-basic (Klokantech Basic)
  • klokantech-3d (Klokantech 3D)
  • klokantech-terrain (Klokantech Terrain)
  • fiord-color (Fiord)
  • toner (Toner)

map.style_show_labels boolean

Display labels.

map.map_zoom_min number

Min. zoom.

Max: 22

map.map_zoom_max number

Max. zoom.

Max: 22

map.map_bound_position boolean

Limit viewport bounds.

map.map_lat_min number

Min. Latitude.

Min: -90

Max: 90

map.map_lat_max number

Max. Latitude.

Min: -90

Max: 90

map.map_lng_min number

Min. Longitude.

Min: -180

Max: 180

map.map_lng_max number

Max. Longitude.

Min: -180

Max: 180

map.controls_geolocator_enabled boolean

Use geolocator control.

map.controls_geolocator_alignment string

Geolocator control position.

Allowed values:

  • top-left (Top left)
  • top-right (Top right)
  • bottom-left (Bottom left)
  • bottom-right (Bottom right)

map.controls_fullscreen_enabled boolean

Use fullscreen control.

map.controls_fullscreen_alignment string

Fullscreen control position.

Allowed values:

  • top-left (Top Left)
  • top-right (Top Right)
  • bottom-left (Bottom Left)
  • bottom-right (Bottom Right)