maprules.spec.md

November 27, 2018 ยท View on GitHub

MapRules Configuration Schema Specification

Example Config

{
    "name": "Public Health Campaign",
    "presets": [
        {
            "fields": [
                {
                    "keyCondition": 1,
                    "key": "opening_hours",
                    "label": "Hours of Operation",
		            "placeholder": "24/7",
                    "values": [
                        {
                            "valCondition": 2,
                            "values": [ "24/7", "sunrise_sunset" ]
                        }
                    ]
                },
                {
                    "keyCondition": 1,
                    "key": "height",
                    "values": [
                        {
                            "valCondition": 5,
                            "values": ["0"]
                        }
                    ]
                }
                {
                    "keyCondition": 1,
                    "key": "name",
                    "values": []
                }
            ],
            "geometry": ["point", "area"],
            "name": "Water Tap",
            "primary": [
                { 
                    "key": "amenity", 
                    "val": "drinking_water" 
                },
                { 
                    "key": "man_made", 
                    "val": "water_tap" 
                }
            ]
        }
    ],
    "disabledFeatures": [
        { 
            "key": "amenity", 
            "val": ["school", "clinic"] 
        }
    ]
}

### Config schema ``` { "project": "Public Health Campaign", "presets": [{...}, {...}], "disabledFeatures": [{ "key": "amenity", "val": ["school", "clinic"] }] } ```
keyvaluedescription
nameStringMapRules project name.
presetsArrayArray of MapRules preset/validation rule configuration objects
disabledFeaturesArrayArray of disabled tags (tags not to be mapped)

### Disabled Features schema ``` "disabledFeatures": [ { "key": "amenity", "val": ["school", "clinic"] } ] ``` | key | value | description | |:-----:|--------|-------------------------------| | key | String | Tag key not to be mapped | | val | Array | Values not to mapped with key |

Primary Tags schema

"primary": [
    {
        "key": "amenity", 
        "val": "drinking_water"
    },
    {
        "key": "man_made", 
        "val": "water_tap"
    }
]
keyvaluedescription
keyStringprimary tag key
valStringprimary tag value

Preset schema

{
    "fields": [{...},{...}],
    "geometry": ["point"],
    "name": "Water Tap",
    "primary": [
        { "key": "amenity", "val": "drinking_water" },
        { "key": "man_made", "val": "water_tap" }
    ]
}
keyvaluedescription
fieldsArrayArray of MapRules preset fields/validaiton selector configuration objects.
geometryArrayArray of OSM types
nameStringPreset name
primaryArrayMapRules preset/validation rule's primary keys (keys always on a feature)

["area", "point"]

OSM Type schema

Geometry Typevaluedescription
pointStringgeometry interpretable as osm node
lineStringgeometry interpretable as osm way (open or closed)
areaStringgeometry interpretable as osm closed way with area tags

Field schema

{
    "keyCondition": 1,
    "key": "opening_hours",
    "label": "Hours of Operation",
    "placeholder": "24/7, sunset to sunrise, Mo-Su...",
    "values": [
        {
            "valCondition": 2,
            "values: [ "24/7", "sunrise_sunset" ]
        }
    ]

}
keyvaluedescription
keyConditionNumberNumeric representation of validation key condition
keyStringField key
labelStringLabel for user interface
placeholderStringPlaceholder for user interface input
valuesArrayfield values that drive preset & validation selectors

### Values schema | key | value | description | |:---------------:|--------|------------------------------------------------------------------------------| | valCondition | Number | Numeric representation of validation value condition | | values | Array | Array of values relevant to value condition | | suggestedValues | Array | Optional array used to suggest values when 'must be' value condition present |

Key Condition schema

valuedescriptionvalidation type
0A feature must not have this key. When key present, throw an error.error
1A feature *must have this key. When key absent, throw error.error
2A feature may have, but is not required to have, this key.warning

### Value Condition schema
valuedescriptionvalidation type
0A tag value must not be a value in the values arrayerror
1A tag value must be a value in the values arrayerror
2A tag value may be a value in the values arraywarning
3A tag value must be less than the validation maximumerror
4A tag value must be less than or equal to the validation maximumerror
5A tag value must be greater than the validation minimumerror
6A tag value must be greater than or equal to the validation minimumerror