Region map (3D, continuous scale)

Updated a year ago by Template retirement home

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

template: _791

version: _3

Template data

There are two different formats in which you can supply data to this template. Which one will be more convenient for you likely depends on the source of your data, as described below.

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:

    {
        regions: [
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            ...
        ]
    }

... but with the keys being the column headers from your source data instead. To tell the API how these 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: "_791",
    version: "_3",
    bindings: {
        regions: {
            geojson: "RegionsHeader1",
            elevation: "RegionsHeader2",
            category: "RegionsHeader3",
            color: "RegionsHeader4"
        }
    },
    data: {
        regions: [
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            ...
        ]
    }
}

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

{
    template: "_791",
    version: "_3",
    bindings: {
        regions: {
            geojson: "RegionsHeader1",
            elevation: "RegionsHeader2",
            category: "RegionsHeader3",
            color: "RegionsHeader4"
        }
    },
    data: {
        regions: [
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            { "RegionsHeader1": ..., "RegionsHeader2": ..., ... },
            ...
        ]
    }
}

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

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: "_791",
version: "_3",
data: {
    regions: [
        {
            geojson: ...,
            elevation: ...,
            category: ...,
            color: ...
        },
        ...
    ]
},
...
}

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

{
template: "_791",
version: "_3",
data: {
    regions: [
        {
            geojson: ...,
            elevation: ...,
            category: ...,
            color: ...
        },
        ...
    ]
},
...
}

Meanings of the template data keys:

  • regions.geojson: geojson
  • regions.elevation: elevation
  • regions.category: category
  • regions.color: color

Template settings

Options for opts.state.

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)

Regions

geojson.geojson_elevation_enabled boolean

Extrude shapes.

geojson.geojson_elevation_normalize string

Normalize elevation.

Allowed values:

  • none (No normalization)
  • both (Normalize: minimum of 0 and maximum of 1)
  • top (Normalize: maximum of 1)

geojson.geojson_elevation_scale number

Elevation scale.

geojson.geojson_stroke_enabled boolean

Enable stroke.

geojson.geojson_stroke_color color

Stroke colour.

geojson.geojson_fill_enabled boolean

Enable fill.

geojson.geojson_color.palette colors

Palette.

geojson.geojson_color.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.

geojson.geojson_color.advanced boolean

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

geojson.geojson_color.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

geojson.geojson_color.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:<br /><hr />Party 1: red<br />Party 2: #4455AA<br />Party 3: rgb(30,168,26)

geojson.geojson_scale string

Color scale.

Allowed values:

  • interpolateBrBG (BrBG)
  • interpolatePRGn (PRGn)
  • interpolatePiYG (PiYG)
  • interpolatePuOr (PuOr)
  • interpolateRdBu (RdBu)
  • interpolateRdGy (RdGy)
  • interpolateRdYlBu (RdYlBu)
  • interpolateRdYlGn (RdYlGn)
  • interpolateSpectral (Spectral)
  • interpolateBlues (Blues)
  • interpolateGreens (Greens)
  • interpolateGreys (Greys)
  • interpolateOranges (Oranges)
  • interpolatePurples (Purples)
  • interpolateReds (Reds)
  • interpolateViridis (Viridis)
  • interpolateInferno (Inferno)
  • interpolateMagma (Magma)
  • interpolatePlasma (Plasma)
  • interpolateWarm (Warm)
  • interpolateCool (Cool)
  • interpolateRainbow (Rainbow)
  • interpolateSinebow (Sinebow)
  • interpolateCubehelixDefault (Cubehelix)
  • interpolateBuGn (BuGn)
  • interpolateBuPu (BuPu)
  • interpolateGnBu (GnBu)
  • interpolateOrRd (OrRd)
  • interpolatePuBuGn (PuBuGn)
  • interpolatePuBu (PuBu)
  • interpolatePuRd (PuRd)
  • interpolateRdPu (RdPu)
  • interpolateYlGnBu (YlGnBu)
  • interpolateYlGn (YlGn)
  • interpolateYlOrBr (YlOrBr)

geojson.geojson_opacity number

Shape opacity.

Max: 1