# Layers Layers provide a way to style and organize the markers associated with source records. Markers can be targeted using attributes and values defined in the records. ### Creating a Layer --- To create a layer, click the **New Layer** button [![image.png](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/scaled-1680-/AQijNUQ1ZrLmE3rO-image.png)](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/AQijNUQ1ZrLmE3rO-image.png) ### Editing a Layer --- #### Title The layer title can be any arbitrary string of text and is only used in the UI #### Target The layer target is a JavaScript expression which should evaluate to either `true` or `false`. Upon saving a layer, the target is evaluated against every source record in order to associate records with the layer. The constant `record` is exposed to the target expression and can be used to filter records based on source data. For example, lets say this is what our source records look like (*represented as a table to save space*):
**School****Grade****Id**
THE11
THE12
DEE23
DEE34
THE35
DEE56
```javascript // Matches records where Grade is equal to 1. (2 records) record['Grade'] == '1' // Matches records where School is equal to THE. (3 records) record['School'] == 'THE' // Matches records where Grade is equal to 1, 2, or 3. (5 records) ['1','2','3'].includes(record['Grade']) // Matches records where School is equal to LRE. (0 records) record['School'] == 'LRE' ``` #### Children Layers can nested by dragging and dropping them in to the parent layer's children container.
[![mapengine-layer-child.gif](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/6Noaqo5BKdWb4Lsk-mapengine-layer-child.gif)](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/6Noaqo5BKdWb4Lsk-mapengine-layer-child.gif)Child layers: - Inherit their parent's style settings - Inherit their parent's visibility - Evaluate their target filter **only** against records that are also matched by their parent - Are deleted when their parent is deleted