MapRules validations

October 9, 2018 ยท View on GitHub

Synopsis

MapRules validations are rules used to make sure OSM features' match some specification of 'valid' tags.' A set of validations are effectively synonymous with a tagging schema. There are two kinds of MapRules validations, 'errors' and 'warnings'.

Errors

When a feature's tags break an error validation, that feature's tags are considered invalid. Thus, to upload that feature to OpenStreetMap is to upload a feature invalid per the MapRules validations.

Warnings

When a feature's tags break a warning validation, that feature's tags are not considered invalid, but rather incomplete. Thus, to upload that feature to OpenStreetMap is to upload an incomplete feature per the MapRules Validation.

Please note, features that are not valid per MapRules Validations are still absolutely valid to upload to OpenStreetMap. Moreover, Validation rules are context specific, meaning two different sets of MapRules validation rules may interpret the same collection of OSM features very differently.

Understanding Validation conditions

Validation conditions are what determine if a validation throws an error, causes a warning, or interprets a feature to be valid.

Note, these conditions are only applied to features that meet a validation's primary tags & geometry conditions. As an illustration, if a validation is intended for closedway features tagged barrier=fence, conditions would not apply to line features tagged barrier=wall.

Like validations, there are 2 kinds of conditionals, key conditions and value conditions.

Key conditions

Key conditions are concerned with an OSM feature tag keys. When a key does not pass a key condition, that validation is broken.

There are three key conditions...

Must have

AttributesDescription
DescriptionA feature must have the tag key in question.
Validation TypeError
ExampleWith a 'must have building key' validation, the absence of a building tag key on a feature breaks the validation.
keyCondition Representation1

#### **May have**
AttributesDescription
DescriptionA feature may have the tag key in question.
Validation TypeWarning
ExampleWith a 'may be building key' validation, the absence of a building tag key on a feature breaks the validation.
keyCondition representation2

#### **Must Not have**
AttributesDescription
DescriptionA feature must not have the tag key in question.
Validation TypeError
ExampleWith a 'must not have building key validation, the presence of a building tag key on a feature breaks the validation.
keyCondition Representation0

#### **Value conditions**

Value conditions are concerned with OSM feature tag values. When a tag value does not pass a value condition, that validation is broken.

There six value conditions...

Must be

AttributesDescription
Validation TypeError
ExampleWith an 'amenity must be 'clinic' or 'school' value condition, a feature tagged 'amenity=drinking_water' breaks the validation; 'amenity=school' passes the validation.
valCondition representation1

#### **May be**
AttributesDescription
DescriptionA feature may have a tag value that is equal to the valid value or one of the valid values.
Validation TypeWarning
ExampleWith an 'amenity must be 'clinic' or 'school' value condition, a feature tagged 'amenity=drinking_water' breaks the validation; 'amenity=school' passes the validation.
valCondition Representation2

#### **Must not be**
AttributesDescription
DescriptionA feature must not have a tag value that is equal to the valid value or one of valid values.
Validation TypeError
ExampleWith an 'amenity must not be 'clinic' or 'school' value condition, a feature tagged 'amenity=clinic' breaks the validation; 'amenity=drinking_water' passes the validation.
valCondition Representation0

#### **Must be less than**
AttributesDescription
DescriptionA feature must have a tag value less than the validation maximum.
Validation TypeError
ExampleWith a 'lanes must be less than 3' value condition, a feature tagged 'lanes=3' breaks the validation.
valCondition Representation3

#### **Must be less than or equal to**
AttributesDescription
DescriptionA feature must have a tag value less than or equal to the validation maximum.
Validation TypeError
ExampleWith a 'lanes must be less than or equal to 3' value condition, a feature tagged wth 'lanes=4' breaks the validation.
valCondition Representation4

#### **Must be greater than**
AttributesDescription
DescriptionA feature must have a tag value greater than the validation minimum.
Validation TypeError
ExampleWith 'lanes must be greater than 3' value condition, a feature tagged with 'lanes=3' breaks the validation.
valCondition Representation5

#### **Must be greater than or equal to**
AttributesDescription
DescriptionA feature must have a tag value that is greater than or equal to the validation minimum.
Validation TypeError
ExampleWith 'lanes must be greater than or equal to 3' value condition, a feature tagged 'lanes=2' breaks the validation.
valCondition Representation6

## Validation Scenarios

Combining key and value conditions generates many different validation scenarios. As a small illustration, if a MapRules Validation set includes a 'key must be building' key condition and 'value may be yes or residential'. A feature without a building tag would throw an error, and one with building=house would throw a warning.

Below are a set of tables to describe the different validation scenarios.

Must not be

Value ConditionKey PresentMissing Key
Key Condition
0errorpasses validation

#### **Value Must Not be in values array**
Value ConditionMissing KeyKey Present & Values in values arrayKey Present & Values not in values array
Key Condition
1errorerrorpasses validation
2warningerrorpasses validation

#### **Value Must be in values array**
Value ConditionMissing KeyKey Present & Values in values arrayKey Present & Values not in values array
Key Condition
1errorpasses validationerror
2warningpasses validationerror

#### **Value May be in values array**
Value ConditionMissing KeyKey Present & Values in values arrayKey Present & Values not in values array
Key Condition
1errorpasses validationwarning
2warningpasses validationwarning

#### **Value Must be less than maximum**
Value ConditionMissing KeyKey Present & Values less than maximumKey Present & Value greater than or equal to maximum
Key Condition
1errorpasses validationerror
2warningpasses validationerror

#### **Value Must be less than or equal to maximum**
Value ConditionMissing KeyKey Present & Values less than or equal to maximumKey Present & Value greater than maximum
Key Condition
1errorpasses validationerror
2warningpasses validationerror

#### **Value Must be greater than minimum**
Value ConditionMissing KeyKey Present & Values less than or equal to maximumKey Present & Value greater than
Key Condition
1errorerrorpasses validation
2warningerrorpasses validation

#### **Value Must be greater than or equal to minimum**
Value ConditionMissing KeyKey Present & Values less than maximumKey Present & Value greater than or equal to
Key Condition
1errorerrorpasses validation
2warningerrorpasses validation