Icon map
Updated 5 years ago by Duncan Clark
How to use this template
What's it for?
Showing locations on an interactive map. Useful both as a locator map to show a few places, or as a data map with many markers filterable by category. Places can be "marked" with emoji, icons from Font Awesome or uploaded images.
How to get started
- At a minimum, you just need a spreadsheet of places with columns for latitude and longitude. Point to these columns and your markers will appear on the map!
category | latitude | longitude |
Tube Station | -6.081689835 | 145.3919983 |
Tube Station | -5.207079887 | 145.7890015 |
Comment | -5.826789856 | 144.2960052 |
- Next you'll need to style your markers by choosing their icon, colour, etc. This can be done in three ways:
- If you want all the icons to look the same, just set the default styling in the Icons settings panel
- If you want to specify individual styles, add columns to your data sheet for icon, size, etc and make sure these are set in the column selection area
- Or if you want to style icons based categories in the data (see below)
Specifying icons
When entering an icon style in one of the tables or in the settings panel, you have three choices:
- Type or copy and paste an emoji
- Type in the name of a Font Awesome icon such as "house" or "dog" (you can find a full list of available icons here. You can include or miss out the "fa-" at the start fo the name.
- Upload an image, by clicking the image upload button or right-clicking on a spreadsheet cell
Working with categories
If your data has a category column you can style your markers at the category level. First make sure the category column is specified in the main data sheet. Then add a row in the "Categories" data sheet for each category you'd like to style. For example:
Category Name | Icon |
Tube Station | 🚇 |
Comment | fa-comment |
Not sure how to upload your data to Flourish? See our handy guide
FAQ
I don't have lat or lng locations, only place names You'll need to geocode your data. Various online tools that can help with this, or the Flourish team may be able to help paying customers.
How do I reset the initial zoom and centre of the map? The map automatically sets its initial zoom and centre to contain all your icons. If you want to override this you have two options. Firt, restrict the bounds of the map (under Base Map > Viewport). Second, create a story: hit the "Create a story" button and drag the map into whatever zoom/pan state you like, and it will be automatically saved. If you don't want the navigation bar at the top, choose "None" from the "Navigation" menu.
How do I change the colour of the icons? Font Awesome icons can be given custom colours. This won't work for emoji or images.
How can I highlight different points on the map? All markers highlight a location. But if you'd like to give the audience a tour of the data, create a Flourish story from your visualisation, then add multiple slides to highlight different places, as in the example below.
Examples
Credits
Created by the Flourish team, using open source tools including twemoji by Twitter under CC-BY 4.0.
Want to see additional features? Let us know at support@flourish.studio.
API information
This section documents API usage specific to this template, so for an introduction we suggest you refer to the generic API documentation instead.
template: _786
version: _1
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: { markers: [ [ "MarkersColumn1Value1", "MarkersColumn2Value1", [ "MarkersColumn1Value2", "MarkersColumn2Value2", [ "MarkersColumn1Value3", "MarkersColumn2Value3", ... ], icons: [ [ "IconsColumn1Value1", "IconsColumn2Value1", [ "IconsColumn1Value2", "IconsColumn2Value2", [ "IconsColumn1Value3", "IconsColumn2Value3", ... ], regions: [ [ "RegionsColumn1Value1", "RegionsColumn2Value1", [ "RegionsColumn1Value2", "RegionsColumn2Value2", [ "RegionsColumn1Value3", "RegionsColumn2Value3", ... ] } }
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: "_786", version: "_1", bindings: { markers: { lat: 0, // index of a column in your data long: 1, // index of a column in your data }, icons: { category_name: 0, // index of a column in your data icon: 1, // index of a column in your data }, regions: { } }, data: { markers: [ [ "MarkersColumn1Value1", "MarkersColumn2Value1", [ "MarkersColumn1Value2", "MarkersColumn2Value2", [ "MarkersColumn1Value3", "MarkersColumn2Value3", ... ], icons: [ [ "IconsColumn1Value1", "IconsColumn2Value1", [ "IconsColumn1Value2", "IconsColumn2Value2", [ "IconsColumn1Value3", "IconsColumn2Value3", ... ], regions: [ [ "RegionsColumn1Value1", "RegionsColumn2Value1", [ "RegionsColumn1Value2", "RegionsColumn2Value2", [ "RegionsColumn1Value3", "RegionsColumn2Value3", ... ] } }
All possible bindings that you can supply are shown in this example:
{ template: "_786", version: "_1", bindings: { markers: { lat: 0, // index of a column in your data long: 1, // index of a column in your data category: 2, // index of a column in your data name: 3, // index of a column in your data image: 4, // index of a column in your data color: 5, // index of a column in your data size: 6, // index of a column in your data metadata: [7, 8, ...], // index(es) of column(s) in your data }, icons: { category_name: 0, // index of a column in your data icon: 1, // index of a column in your data size: 2, // index of a column in your data color: 3, // index of a column in your data opacity: 4, // index of a column in your data }, regions: { geojson: 0, // index of a column in your data } }, data: { markers: [ [ "MarkersColumn1Value1", "MarkersColumn2Value1", [ "MarkersColumn1Value2", "MarkersColumn2Value2", [ "MarkersColumn1Value3", "MarkersColumn2Value3", ... ], icons: [ [ "IconsColumn1Value1", "IconsColumn2Value1", [ "IconsColumn1Value2", "IconsColumn2Value2", [ "IconsColumn1Value3", "IconsColumn2Value3", ... ], regions: [ [ "RegionsColumn1Value1", "RegionsColumn2Value1", [ "RegionsColumn1Value2", "RegionsColumn2Value2", [ "RegionsColumn1Value3", "RegionsColumn2Value3", ... ] } }
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:
{ markers: [ { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, ... ], icons: [ { "IconsHeader1": ..., "IconsHeader2": ..., ... }, { "IconsHeader1": ..., "IconsHeader2": ..., ... }, { "IconsHeader1": ..., "IconsHeader2": ..., ... }, ... ], regions: [ { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, ... ] }
... 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: "_786", version: "_1", bindings: { markers: { lat: "MarkersHeader1", long: "MarkersHeader2", }, icons: { category_name: "IconsHeader1", icon: "IconsHeader2", }, regions: { } }, data: { markers: [ { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, ... ], icons: [ { "IconsHeader1": ..., "IconsHeader2": ..., ... }, { "IconsHeader1": ..., "IconsHeader2": ..., ... }, { "IconsHeader1": ..., "IconsHeader2": ..., ... }, ... ], regions: [ { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, ... ] } }
All possible bindings that you can supply are shown in this example:
{ template: "_786", version: "_1", bindings: { markers: { lat: "MarkersHeader1", long: "MarkersHeader2", category: "MarkersHeader3", name: "MarkersHeader4", image: "MarkersHeader5", color: "MarkersHeader6", size: "MarkersHeader7", metadata: ["MarkersHeader8", "MarkersHeader9", ...], }, icons: { category_name: "IconsHeader1", icon: "IconsHeader2", size: "IconsHeader3", color: "IconsHeader4", opacity: "IconsHeader5", }, regions: { geojson: "RegionsHeader1", } }, data: { markers: [ { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, { "MarkersHeader1": ..., "MarkersHeader2": ..., ... }, ... ], icons: [ { "IconsHeader1": ..., "IconsHeader2": ..., ... }, { "IconsHeader1": ..., "IconsHeader2": ..., ... }, { "IconsHeader1": ..., "IconsHeader2": ..., ... }, ... ], regions: [ { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, { "RegionsHeader1": ..., "RegionsHeader2": ..., ... }, ... ] } }
(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: "_786", version: "_1", data: { markers: [ { lat: ..., long: ..., metadata: [...] }, ... ], icons: [ { category_name: ..., icon: ... }, ... ] }, ... }
And the full list of all possible properties is as follows:
{ template: "_786", version: "_1", data: { markers: [ { lat: ..., long: ..., category: ..., name: ..., image: ..., color: ..., size: ..., metadata: [...] }, ... ], icons: [ { category_name: ..., icon: ..., size: ..., color: ..., opacity: ... }, ... ], regions: [ { geojson: ... }, ... ] }, ... }
Meanings of the template data keys:
- markers.lat: lat
- markers.long: long
- markers.category: Category of place. Values should match the 'Category' column in the Icon styles sheet.
- markers.name: Name of place, shown in popup
- markers.image: Can include emojis, Font Awesome icons or uploaded images
- markers.color: Colour of the icon - this can be a hex value like '#fff', or a web-safe value like 'red'. Note that this is only available for Font Awesome icons.
- markers.size: size
- markers.metadata: Extra metadata to show in the popup. Add as many columns as you like.
- icons.category_name: Values should match the 'Category' column in the Places sheet, and should not be repeated.
- icons.icon: The image for the marker. Can be a Font Awesome icon name, e.g. 'circle' or 'chevron-right'; a D3 SVG icon name, e.g. 'd3-star' or 'd3-cross'; an image URL; or an emoji.
- icons.size: Amount to scale the icon by.
- icons.color: Colour of the icon - this can be a hex value like '#fff', or a web-safe value like 'red'. Note that this is only available when using Font Awesome icon names.
- icons.opacity: Opacity of the icon between 0 and 1, e.g. 0.5
- regions.geojson: geojson
Template settings
Options for opts.state
.
Base map
map.style_base string
Map style. Allowed values:
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.map_interactive boolean
Allow user interaction.
map.map_hijack_scroll boolean
Require cmd/ctrl to zoom when scrolling.
map.controls_geolocator_enabled boolean
Use geolocator control.
map.controls_geolocator_alignment string
Geolocator control position. Allowed values:
map.controls_fullscreen_enabled boolean
Use fullscreen control.
map.controls_fullscreen_alignment string
Fullscreen control position. Allowed values:
Inset map
minimap.minimap_display boolean
Display map.
minimap.minimap_rotate boolean
Rotate with camera.
minimap.minimap_custom_colors boolean
Customise colours.
minimap.minimap_fill color
Region fill color.
minimap.minimap_ocean_color color
Ocean color.
minimap.minimap_stroke color
Region stroke color.
minimap.minimap_outline color
Outline color.
minimap.minimap_show_bounds boolean
Display viewport bounds.
minimap.minimap_bounds_color color
Region bounds color.
minimap.minimap_bounds_opacity number
Region bounds opacity. Max: 1
Icons
icon_scale number
Scale. Max: 100
icon_default_icon url
Icon. Can be an emoji, icon code or image; used for any icons that don't have an icon in the data
icon_default_opacity number
Opacity. Max: 1
icon_default_color color
Colour.
Labels
label_size number
Label size.
label_offset number
Label offset.
label_autohide boolean
Hide overlapping labels.
label_custom_style boolean
Customise label style.
label_color color
Label color.
label_halo_color color
Halo color.
label_halo_width number
Halo width.
label_halo_blur number
Halo blur.
Legend
legend_show boolean
Show legend.
legend_title string
Title.
legend_background color
Box.
legend_text_color color
Text.
legend_opacity number
Opacity. Max: 1
Popups
popup.show_popups boolean
Popups. Allowed values:
popup.is_custom boolean
Popup contents. Allowed values:
popup.custom_template text
Popup content. The text to appear in the popup. You can use {{column_name}} to add a value from your data. It must be in a selected column, but you can add columns to “Metadata” if you just want to include them for use in the popup. Advanced users can include HTML to apply layouts, formatting, images, etc.
popup.show_pointer boolean
Pointer.
popup.show_shadow boolean
Shadow.
popup.style_popups boolean
Custom styling.
popup.text_color color
Text colour.
popup.align string
Alignment. Allowed values:
popup.font_size number
Font size. Min: 1
popup.fill_color color
Fill colour.
popup.opacity number
Fill opacity. Max: 1
popup.padding number
Padding.
popup.border_radius number
Radius. Corner radius of popup