Using layer attributes to add labels to your map
This article is for Citizen Space Geospatial. Please speak to your customer success manager if you are interested in learning more about it.
Attributes are the non-spatial information about a geographic feature, for example the name or description of each feature within a layer. These attributes will be displayed in an attribute panel as additional information when a respondent clicks on that feature on the map.
Each attribute consists of
- An attribute ID, designating what kind of information the attribute contains, e.g. 'Name', 'Location', 'Postcode' or 'Website', and represented on the map feature's attribute panel by an editable 'Label'. The attribute IDs or 'Labels' are the same for every feature in the map.
- An attribute value, which is the specific information about a map feature corresponding to the attribute ID. The attribute values are unique to each individual feature on the map.
For example, if you have a GeoJSON file showing the location of local bicycle shops, that GeoJSON file might also include additional data such as the name of the bicycle shop, the URL of its website, what services it provides etc.
This article explains how to:
- Configure built-in attributes (uploaded layers only)
- Add custom layer attributes (for drawn and uploaded layers)
- Edit feature values (for drawn and uploaded layers)
- Format you attributes (for drawn and uploaded layers)
- and also includes examples of differently configured attribute panels
Configuring built-in attributes (uploaded layers only)
First, add your layer by following the steps in this article.
To choose which attributes you would like to appear on the map, select 'Choose attributes' in the information block for that layer.
The following screen will display a preview map and below this all of the available attributes, each in its own information block. The 'Visibility' setting in the information blocks enable you to set each attribute to be either shown or not shown in the features' attribute panels. The default for attributes will always be 'Don't show'. On the preview map, you can click on any feature to see how its attribute panel will appear.
If you choose to show an attribute, additional formatting options will appear in that attribute's information block.
Adding custom layer attributes (for drawn and uploaded layers)
As well as displaying existing attributes from your uploaded layers, you can add and edit custom attributes for both uploaded and drawn layers.
First, draw or upload a layer by following the steps in this article.
To add a custom layer attribute, select 'Choose attributes' in the information block for that layer.
The following screen displays a preview map and any existing attributes for that layer. Select the 'Add new layer attribute' button.
Give the new attribute a label and click the 'Add attribute' button:
This new attribute will now be available on all features in this layer. To edit the values of this new attribute, see the section on Editing feature values.
Editing feature values (for drawn and uploaded layers)
Once you have configured the attributes for a layer, you can also change the values of the attributes for each individual feature in your layer.
To edit the feature values for a layer, select 'Choose attributes' on the relevant layer's information block on the Configure map layers page.
Use the preview map at the top of the 'Choose attributes' page to select the feature you want to edit the values for. On the attribute panel that appears for your feature, select 'Edit feature values'.
The following screen displays a preview map showing only the selected feature with a list of its attributes in an information block below. For each attribute label you can enter a value for the selected feature. The preview map will automatically update as you make changes to the feature values. When you have finished making changes, select 'Save feature attributes'.
You can then return to the previous screen and choose a different feature to edit by selecting the 'Back to Choose layer attributes' button .
Manually added attributes can be formatted in the same way as uploaded attributes.
Formatting your attributes
Once you have set an uploaded layer's attribute to 'Show', or added attributes to drawn layers, additional formatting options will appear in that attribute's information block.
You can set the ‘Label’ text indicating what the attribute is (e.g. ‘Name’). If you leave the ‘Label’ field blank, no label will appear before the attribute value. Often the 'Label' will be the same as the attribute ID, but there may be instances where you want a different word or phrase to appear or wish to hide the 'Label' altogether.
You can also choose the ‘Style’ of the attribute. The two styles are ‘Text’ and ‘Link’.
If you select the ‘Text’ style, you can set the following style options:
- Show label when empty, meaning the label text will display even if there is no corresponding attribute value associated with it.
- Display as a title, meaning the attribute will be formatted in larger typeface to appear as the title of the attribute panel.
- Please note, setting an attribute as a title will not automatically move it to the top of the attribute panel. The order in which the attributes appear in the panels is determined by the order of the attribute information blocks on the 'Choose attributes' screen. These can be re-ordered by using the 'Move up' and 'Move down' arrows on the right hand side of each block, or by dragging-and-dropping the information blocks into the correct position.
- Also, while it is technically possible to set more than one attribute as the 'Title', we advise against doing this.
If you select the ‘Link’ style, you can set the following style options:
- Show label when empty, meaning the label text will display even if there is no corresponding attribute value associated with it.
- Display as a title, meaning the attribute will be formatted in larger typeface to appear as the title of the attribute panel.
- Please note, setting an attribute as a title will not automatically move it to the top of the attribute panel. The order in which the attributes appear in the panels is determined by the order of the attribute information blocks on the 'Choose attributes' screen. These can be re-ordered by using the 'Move up' and 'Move down' arrows on the right hand side of each block, or by dragging-and-dropping the information blocks into the correct position.
- Also, while it is technically possible to set more than one attribute as the 'Title', we advise against doing this.
- Open link in new tab, determining whether the link will open in the respondent's existing browser tab or in a new tab. We highly recommend that you set links within activities to open in new tabs to minimise the risk of respondents accidentally navigating away from the activity before they have completed and submitted their response.
You also have the option to customise the link text, allowing you to type in a specific word or phrase to appear as the hyperlink in place of the URL which is the attribute value. Alternatively, you can select another of the feature's attributes to appear as the hyperlink text. This allows you to use, for example, the ‘Name’ attribute of a feature as both the name and a hyperlink to an associated website or other online resource.
A few things to bear in mind:
- Simply selecting the 'Link' style for an attribute won't magically turn that attribute into a working link unless the attribute value is a valid URL.
- When manually adding website attribute values, you must include the ‘https://’ prefix in the URLs (as in the screenshot above), otherwise the hyperlinks won’t work.
- If you choose another attribute as the hyperlink text for your link attribute, that attribute will still show in the attribute panel unless it is set to ‘Don’t show’, i.e. it will appear twice: once in its own right, and once as the hyperlink.
- If you want an attribute to double as both a link and as a title (as in the third example pictured below), it is the link attribute that must be set to 'Display as title', not the attribute that is set as the link text, which, as described above, should be set to 'Don't Show'.
The preview map will automatically update to reflect any changes you make to the visibility, formatting style and order of attributes. Once you are happy with your changes you can select 'Save layer attributes' at the bottom of the page.
Once you have finished editing and formatting your attributes it is always a good idea to use preview mode to check how things look. To ensure maps are as clear and user-friendly as possible, consider carefully whether the information you have chosen to show on the map is genuinely useful for your respondents within the context of the map and the question that accompanies it.
Examples of some differently formatted attribute panels
A standard attribute panel with attribute labels and attribute values visible for all shown attributes:
The same attribute panel, except
- the ‘Name’ attribute has been set as the title
- the ‘Name’ attribute label has been hidden (by deleting the text from that field)
- the ‘Website’ attribute has been set as a link rather than text
The same attribute panel again, except this time:
- the ‘Name’ attribute has been hidden (set to ‘Not shown’)
- the ‘Website’ attribute has been set as the title
- the ‘Website’ attribute link text has been set as the ‘Name’ attribute
- the ‘Website’ attribute label has been hidden (by deleting the text from the 'Label' field)