Projection map (beta)

Build a map with your own GeoJSON file

Updated a year ago by Template retirement home

How to use this template

Credits

The default points data comes from the GeoNames dataset of cities with populations of above 150,000, http://www.geonames.org/export/.

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

template: _679

version: _4

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:

    {
        choropleth: [
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            ...
        ],
        points: [
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            ...
        ]
    }

... 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: "_679",
    version: "_4",
    bindings: {
        choropleth: {
            
        },
        points: {
            
        }
    },
    data: {
        choropleth: [
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            ...
        ],
        points: [
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            ...
        ]
    }
}

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

{
    template: "_679",
    version: "_4",
    bindings: {
        choropleth: {
            geometry: "ChoroplethHeader1",
            name: "ChoroplethHeader2",
            value: "ChoroplethHeader3"
        },
        points: {
            name: "PointsHeader1",
            lon: "PointsHeader2",
            lat: "PointsHeader3",
            color: "PointsHeader4",
            value: "PointsHeader5"
        }
    },
    data: {
        choropleth: [
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            { "ChoroplethHeader1": ..., "ChoroplethHeader2": ..., ... },
            ...
        ],
        points: [
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            { "PointsHeader1": ..., "PointsHeader2": ..., ... },
            ...
        ]
    }
}

(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: "_679",
version: "_4",
data: {},
...
}

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

{
template: "_679",
version: "_4",
data: {
    choropleth: [
        {
            geometry: ...,
            name: ...,
            value: ...
        },
        ...
    ],
    points: [
        {
            name: ...,
            lon: ...,
            lat: ...,
            color: ...,
            value: ...
        },
        ...
    ]
},
...
}

Meanings of the template data keys:

  • choropleth.geometry: geometry
  • choropleth.name: name
  • choropleth.value: value
  • points.name: name
  • points.lon: lon
  • points.lat: lat
  • points.color: color
  • points.value: value

Template settings

Options for opts.state.

Projection

projection string

Projection.

Allowed values:

  • Albers (30° & 45°)
  • Albers USA
  • August
  • Azimuthal Equidistant
  • Aitoff
  • Baker
  • Boggs
  • Braun's Stereographic
  • Bromley
  • Craster Parabolic
  • Eckert I
  • Eckert II
  • Eckert III
  • Eckert IV
  • Eckert V
  • Eckert VI
  • Eisenlohr
  • Equirectangular
  • Fahey
  • Foucaut
  • Ginzburg IV
  • Ginzburg V
  • Ginzburg VI
  • Ginzburg VIII
  • Ginzburg IX
  • Gnomonic
  • Hammer
  • Kavrayskiy VII
  • McBryde–Thomas Flat-Polar Parabolic
  • McBryde–Thomas Flat-Polar Quartic
  • McBryde–Thomas Flat-Polar Sinusoidal
  • Miller (modified Mercator)
  • Mollweide
  • Natural Earth I
  • Natural Earth II
  • Orthographic
  • Robinson
  • Sinusoidal
  • Stereographic
  • Wagner IV
  • Wagner VI
  • Winkel Tripel

fit string

Bounds.

Allowed values:

  • map (Auto)
  • world (World)
  • advanced (Advanced)

centering string

Allowed values:

  • rotate (Rotate projection)
  • center (Translate map)

min_area number

Minimum area. In km². Polygons representing areas below this size won't be considered when fitting the map. Setting is ignored if no polygons are bigger than the specified minimum area.

longitude number

Centre long..

latitude number

Centre lat..

roll number

Rotation.

padding number

Padding (%). Padding added to map (as percentage of smaller of width and height)

Max: 10

zoom number

Zoom. 1 to show whole world, > 1 to zoom in.

aspect number

Aspect ratio. Width divided by height. If left blank will use aspect ratio of projection for whole world.

Points layer

point_show boolean

Show points.

point_min_radius number

Minimum radius. Any smaller circles will be scaled up to the specified level. (Ignored if greater than the “Maximum radius” setting.)

point_max_radius number

Maximum radius.

point_default_radius number

Radius.

point_max_value number

Maximum value. Values bigger than this maximum will have a radius equal to the maximum radius. Leave blank to use the maximum in the dataset

point_opacity number

Opacity.

Max: 1

point_fill color

Default fill.

point_color_mode string

Palette type.

Allowed values:

  • specified (Use a specified palette)
  • generated (Use a generated palette)

point_palette colors

Palette.

point_base_color color

Base colour.

point_hue_rotation_angle number

Advanced: hue rotation angle. Angle between one colour and the next (HCL colourspace). The default value, equal to 360/(Golden ratio), ensures adjacent colurs are very different and colours are not repeated.

Max: 360

legend_show boolean

Show legend. Legend will always be hidden if there are over 100 categories

legend_interaction boolean

Click legend swatch to hides/show points.

point_formatting.prefix string

Prefix. Text to place in front of number

point_formatting.suffix string

Suffix. Text to place after number

point_formatting.n_dec number

Decimal places. Use negative integers to round to positive powers of ten (eg -2 rounds to the nearest 100)

Min: -10

Max: 10

point_formatting.strip_zeros boolean

Remove trailing zeros.

point_formatting.strip_separator boolean

Hide thousands separator below 10,000. Turn off if you want four-digit numbers to include a separator, e.g. “1,234” rather than “1234”.

point_formatting.transform_labels boolean

Multiply/divide values.

point_formatting.transform string

Allowed values:

  • multiply (Multiply by)
  • divide (Divide by)
  • exponentiate (×10 to the power of)

point_formatting.multiply_divide_constant number

point_formatting.exponentiate_constant number

point_show_popup boolean

Show popup.

point_hide_popup_pointer boolean

Hide pointer.

Regions layer

map_show boolean

Show regions.

map_fill color

Fill. Ignored for regions with values.

map_fill_opacity number

Fill opacity.

Max: 1

map_show_stroke boolean

Show outline.

map_stroke color

Outline colour.

map_stroke_width number

Outline width.

Max: 5

map_stroke_opacity number

Outline opacity.

Max: 1

map_scale_type string

Type.

Allowed values:

  • continuous (Continuous)
  • discrete (Discrete)
  • categorical (Categorical)

map_numeric_type string

Allowed values:

  • sequential (Sequential)
  • diverging (Diverging)

sequential_palette string

Palette.

Allowed values:

  • Oranges
  • Reds
  • Blues
  • Greens
  • Greys
  • Purples
  • Viridis
  • Inferno
  • Magma
  • Plasma
  • Warm
  • Cool
  • CubehelixDefault (Cubehelix)
  • BuGn (Blue/Green)
  • BuPu (Blue/Purple)
  • GnBu (Green/Blue)
  • OrRd (Orange/Red)
  • PuBuGn (Purple/Blue/Green)
  • PuBu (Purple/Blue)
  • PuRd (Purple/Red)
  • RdPu (Red/Purple)
  • YlGnBu (Yellow/Blue/Green)
  • YlGn (Yellow/Green)
  • YlOrBr (Yellow/Orange/Brown)
  • YlOrRd (Yellow/Orange/Red)

diverging_palette string

Palette.

Allowed values:

  • RdBu (Red/Blue)
  • RdYlGn (Red/Yellow/Green)
  • PiYG (Pink/Yellow/Green)
  • BrBG (Brown/Blue/Green)
  • PRGn (Purple/Red/Green)
  • PuOr (Purple/Orange)
  • RdGy (Red/Grey)
  • RdYlBu (Red/Yellow/Blue)
  • Spectral

reverse_scale_colors boolean

Reverse colours.

underflow_value number

Gradient start. Defaults to a value close to the minimum of the data.

midpoint_value number

Gradient midpoint. Defaults to the value halfway between the start and end points.

overflow_value number

Gradient end. Defaults to value close to the minimum of the data.

discrete_mode string

Mode.

Allowed values:

  • fixed (Fixed-width binning)
  • quantile (Quantile binning)
  • custom (Custom binning)

n_bins number

Number of bins.

Min: 1

custom_thresholds string

Thresholds. List numeric thresholds, separated by semi-colons.

categorical_color_mode string

Palette type.

Allowed values:

  • specified (Use a specified palette)
  • generated (Use a generated palette)

categorical_palette colors

Palette.

categorical_base_color color

Base colour.

categorical_hue_rotation_angle number

Advanced: hue rotation angle. Angle between one colour and the next (HCL colourspace). The default value, equal to 360/(Golden ratio), ensures adjacent colurs are very different and colours are not repeated.

Max: 360

choropleth_missing_values string

Action.

Allowed values:

  • fill (Use Fill colour)
  • transparent (Make region transparent)
  • hide (Hide region)
  • pattern (Use a pattern)

missing_pattern_opacity number

Opacity. This value is multiplied by the Fill opacity value.

Max: 1

missing_pattern_size number

Square size.

Min: 1

Max: 20

missing_pattern_color_1 color

Colour 1.

missing_pattern_color_2 color

Colour 2.

choropleth_legend_show boolean

Show legend. Categorical legend will always be hidden if there are over 100 categories

legend_min number

Legend minimum. Leave blank to autofit based on data and colour scales. Value is ignored if not less than the legend maximum.

legend_max number

Legend maximum. Leave blank to autofit based on data and colour scales. Value is ignored if not greater than the legend maximum.

legend_labels string

Label.

Allowed values:

  • thresholds (Thresholds)
  • centers (Centres)
  • nice (Nice)
  • custom (Custom)

n_nice_ticks number

Aproximate number of labels.

legend_labels_custom string

Labels. List numeric values, separated by semi-colons.

legend_enhancement string

Enhancement.

Allowed values:

  • none (None)
  • markers (Value markers)

map_formatting.prefix string

Prefix. Text to place in front of number

map_formatting.suffix string

Suffix. Text to place after number

map_formatting.n_dec number

Decimal places. Use negative integers to round to positive powers of ten (eg -2 rounds to the nearest 100)

Min: -10

Max: 10

map_formatting.strip_zeros boolean

Remove trailing zeros.

map_formatting.strip_separator boolean

Hide thousands separator below 10,000. Turn off if you want four-digit numbers to include a separator, e.g. “1,234” rather than “1234”.

map_formatting.transform_labels boolean

Multiply/divide values.

map_formatting.transform string

Allowed values:

  • multiply (Multiply by)
  • divide (Divide by)
  • exponentiate (×10 to the power of)

map_formatting.multiply_divide_constant number

map_formatting.exponentiate_constant number

map_show_popup boolean

Show popup.

map_hide_popup_pointer boolean

Hide pointer.

map_shadow boolean

Add shadow.

map_shadow_offset_x number

Horizontal offset.

map_shadow_offset_y number

Vertical offset.

map_shadow_blur number

Blur.

map_shadow_color color

Colour.

map_shadow_opacity number

Opacity.

Max: 1

Graticule layer

graticule_show boolean

Show graticule.

graticule_color color

Colour.

graticule_width number

Width.

Max: 5

graticule_opacity number

Opacity.

Max: 1

graticule_separation_longitude number

Longitude separation (°).

Min: 1

Max: 180

graticule_separation_latitude number

Latitude separation (°).

Min: 1

Max: 90

Globe layer

globe_show boolean

Show globe.

globe_color color

Globe colour.

Background

background color

Colour.

header.title string

Title.

header.subtitle string

Subtitle.

header.color color

Color.

header.align string

Alignment.

Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)

header.margin number

Margin.

header.margin_advanced boolean

Advanced margin settings.

header.margin_top number

Top.

header.margin_right number

Right.

header.margin_bottom number

Bottom.

header.margin_left number

Left.

footer.source_name string

Source name.

footer.source_url string

Source url.

footer.multiple_sources boolean

Multiple sources.

footer.source_name_2 string

Source name.

footer.source_url_2 string

Source url.

footer.source_name_3 string

Source name.

footer.source_url_3 string

Source url.

footer.source_label string

Source label.

footer.note string

Note.

footer.size number

Size.

footer.color color

Color.

footer.align string

Alignment.

Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)

footer.margin number

Overall.

footer.margin_top number

Top.

footer.margin_right number

Right.

footer.margin_bottom number

Bottom.

footer.margin_left number

Left.

footer.margin_advanced boolean

Advanced.

Number styles

localization.input_decimal_separator string

Decimal separator in data sheet. Used for interpreting your data. Only change if data is not displaying on the chart as expected.

Allowed values:

  • . (.)
  • , (,)

localization.output_separators string

Number format to display. How the numbers should appear on chart labels

Allowed values:

  • ,. (12,235.67)
  • ., (12.345,67)
  • . (12235.67)
  • , (12345,67)
  • . (12 235.67)
  • , (12 345,67)

Performance (advanced)

precision number

Precision. Lower numbers create smoother lines but may take longer to render

Min: 0.01

max_pixel_ratio number

Maximum graphic scaling (pixel ratio). The template will generate larger images and scale them down on high-resolution screens to improve image quality. Performance may be improved by preventing or reducing this scaling.