# MapEngine # Settings ## Clustering --- Clustering is used to group nearby markers together.
**Option****Description**
`Enable Clustering`Toggles clustering on or off
`Min Zoom`Minimum zoom level at which clusters are generated
`Max Zoom`Maximum zoom level at which clusters are generated
`Radius`Cluster radius (in pixels)
`Extent`Tile extent - radius is calculated relative to this value
[![image.png](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/scaled-1680-/B0VTUPtl71HDVT1E-image.png)](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/B0VTUPtl71HDVT1E-image.png)
## Project ---
[![image.png](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/scaled-1680-/7VncJ4lJ3UA6zf2n-image.png)](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/7VncJ4lJ3UA6zf2n-image.png)
### Exporting Clicking the **Export** button will save your sources and layers to a file and download it to your device. ### Importing Clicking the **Choose file** button will prompt you to upload a MapEngine export file. The application will remove any existing data and rebuild the sources and layers (*including their visibility, style, target filter, and relationships*) contained in the export file. # Sources ### Records ---
[![image.png](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/scaled-1680-/eWNvkfdjULVuRzmi-image.png)](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/eWNvkfdjULVuRzmi-image.png)Record source files are a JSON formatted array of objects with each object containing at minimum a `lat` and `lng` key. Each record is attached to a marker which is placed on the map according to the latitude (`lat`) and longitude (`lng`) keys. Any other arbitrary properties and values can be included in each record. ```json [ { "First Name":"John", "Last Name":"Smith", ... "lat":"47.204935", "lng":"-122.237967" }, { "First Name":"Jane", "Last Name":"Doe", ... "lat":"47.204157", "lng":"-122.231124" } ] ```
Skyward typically exports data in CSV format, however there are many free online tools which can convert CSV files to JSON. The Technology Services department can perform bulk geocoding of addresses if needed.
**CSV****JSON**
```csv First Name,Last Name,lat,lng John,Smith,47.204935,-122.237967 Jane,Doe,47.204157,-122.231124 ``` ```JSON [ { "First Name":"John", "Last Name":"Smith", "lat":"47.204935", "lng":"-122.237967" }, { "First Name":"Jane", "Last Name":"Doe", "lat":"47.204157", "lng":"-122.231124" } ] ```
### ### GeoJSON ---
[![image.png](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/scaled-1680-/NUn8zOrtOSddPnlf-image.png)](https://wiki.sumnersd.org/uploads/images/gallery/2023-11/NUn8zOrtOSddPnlf-image.png)A GeoJSON source is a file which defines geospatial features (*e.g school boundaries*) in the [GeoJSON format](https://en.wikipedia.org/wiki/GeoJSON). A repository of optimized SBLSD boundary files can be downloaded from [github.com/sblsd/gis](https://github.com/sblsd/gis).
# 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