Skip to content

Configuration details

Trevor Croxson edited this page Jun 30, 2017 · 12 revisions

Each Mapseed flavor contains a config.yml file that is used to configure application behavior. There are many configuration options, and this section of the wiki is intended to be a (work in progress) catalog of those options and how to use them.

Map configuration

...

Dynamic form configuration

The dynamic form allows users to create new pieces of geometry on the map. The form supports numerous input types and options, described in this section. Below is an example of a dynamic form configuration, found under the place section of the config:

place:
  adding_supported: true
  add_button_label: _(Add Report)
  show_list_button_label: _(See All Reports)
  show_map_button_label: _(Show the Map)
  action_text: _(added)
  anonymous_name: _(Someone)
  submit_button_label: _(Put it on the map!)
Property Description
adding_supported A boolean which controls whether or not the dynamic form is available to map users.
add_button_label The message that appears on the button which opens the dynamic form.
show_list_button_label The message that appears on the button which opens the list view.
show_map_button_label The message that appears on the button which opens the map form.
action_text The phrase incorporated into place detail views which describes the action taken to create a new place.
anonymous_name The name given to anonymous submitters in action text.
submit_button_label The message that appears on the button which submits data from the dynamic form and creates a new place on the map.

Dynamic form category configuration

Individual dynamic form categories are configured under the place_detail section, found under the place section of the config. place_detail is an array of category configuration information, with an entry for each location_type that is configured to appear on the map:

place_detail:
  - category: featured_place
    admin_only: true
    includeOnForm: true
    showMetadata: false
    suppressAttachments: true
    horizontal_rule: true
    name: location_type
    dataset: duwamishfeatured
    icon_url: /static/css/images/markers/marker-star.png
    value: featured_place
    label: _(Featured Place)
    fields:
      - name: published
        type: publishControl
      - name: geometry
        type: geometryToolbar
        content:
          - url: /static/css/images/markers/marker-bike.png
          - url: /static/css/images/markers/marker-construction.png
          - url: /static/css/images/markers/marker-foodforest.png
      - name: title
        type: text
        prompt: _(Title of this featured site:)
        display_prompt: _( )
        placeholder: _(Enter title...)
        optional: false
      - name: description
        type: richTextarea 
        prompt: _(Description:)
        display_prompt: _( )
        placeholder: _( )
      - name: url-title
        type: url-title
        prompt: _(Choose a custom URL for this place:)
        placeholder: "my-new-featured-place"
        optional: true

Right-clinging sidebar configuration

...

Leaflet sidebar configuration

...

Layer style rules configuration

Layer style rules, found under the place_types section of the config, control how icons, polygons, and linestrings appear on the map. Style rules define conditions (such as a map zoom level) and associate style rules with those conditions.

Below is an example of a typical style rule. The top-level key, (construction and featured in the example below), should match the name of the location_type to which the affiliated rules apply:

construction:
    rules:
      - condition: 'this.layer.focused === true'
        icon:
          iconSize: [50, 50]
          iconAnchor: [25, 25]
      - condition: 'this.map.zoom < 15'
        icon:
          iconUrl: /static/css/images/markers/marker-construction-dot.png
          iconSize: [10, 10]
          iconAnchor: [0, 0]
      - condition: 'this.map.zoom <= 18'
        icon:
          iconUrl: /static/css/images/markers/marker-construction.png
          iconSize: [30, 30]
          iconAnchor: [15, 15]

featured:
    rules:
      - condition: 'this.geometry.type == "LineString"'
        style:
          color: "this.style.color"
          opacity: "this.style.opacity"
          weight: "this.style.weight"

Style rules are evaluated each time the map zoom level changes, and once for each piece of geometry on the map. When style rules are evaluated, each condition listed under the rules section is evaluated, in order, until a condition returns true. Once a condition returns true, the style rule for that condition is used. If no condition returns true, then the affiliated geometry will not appear on the map under the current conditions.

Style rule configuration options

Property Description
condition A string containing a javascript expression which can be evaluated for true/false status. When writing style rule expressions, you can incorporate any of a model's properties using the this. syntax. Additionally, you can incorporate the map's current zoom level with this.map.zoom, and whether a given layer is currently focused by using this.layer.focused.
icon (For Marker geometry). An object containing settings for the icon affiliated with this Marker geometry. Any of an icon's properties can be set. See here for full documentation.
style (For GeoJSON polygon and linestring geometry). An object containing path options for this GeoJSON geometry. Any GeoJSON path properties can be set. See here for full documentation.

Story mode configuration

The story section of the config.yml file configures the behavior of a flavor's story mode. You can control which points on your map appear in a story, which zoom level and centerpoint are used for individual story points, whether the spotlight overlay appears when visiting a story point, and so forth.

Below is an example of a typical story configuration, followed by an explanation of all options used:

story:
  budget-priorities:
    tagline: _(Next budget priority)
    default_zoom: 17
    default_basemap: satellite
    default_visible_layers:
      - 2015-budget-priorities
      - city-council-districts
    order: 
      - url: street-paving
        spotlight: false
        visible_layers:
          - streets
        basemap: dark
      - url: report/214
        zoom: 10
        panTo:
          lat: -122.24877834320068
          lng: 47.731328313742345
      - url: park-improvements
        spotlight: false
        sidebar_icon_url: /static/css/images/markers/map-pin-marker.png

Story configuration options

Property Description
tagline A string that appears in the story control bar at the bottom of a place detail view.
default_zoom A map zoom level that will be used for all story points unless a story point sets its own zoom level.
default_basemap The basemap that will be shown for all story points unless a story point sets its own basemap.
default_visible_layers An array of map layers that will be shown for all story points unless a story point sets its own array of visible layers.
order An array of urls and optional configuration details that defines the in-order content of a story.

Story item configuration options

NOTE: these options should appear in array entries under the order property, described above.

Property Description
url Required. The relative url of a story point.
spotlight Optional. A boolean value indicating whether or not to display the map spotlight overlay. Defaults to true.
visible_layers Optional. An array of layers that will be shown for this story point. Completely overrides default_visible_layers.
basemap Optional. The basemap that will be shown for this story point. Overrides default_basemap.
zoom Optional. The map zoom level that will be used for this story point. Overrides default_zoom.
panTo Optional. An object of lat and lng coordinates to use as the map centerpoint for this story item. Overrides the centerpoint of the underlying geometry.
sidebar_icon_url Optional. The path to an icon image to use for this story point in the sidebar. If not supplied, the sidebar icon used will be derived from the place section of the config.
Clone this wiki locally