wiki:Rules/QAToolInspiredValidations

Version 12 (modified by abalosc1, 5 years ago) ( diff )

remove deprecated tags to put into deprecated.mapcss so it's all in the same place and in the same format

meta
{
  title: "Osmose Validations";
  version: "37_2020-11-06";
  description: "Checks for errors based on Osmose tag checks";
  author: "Dave Manzer";
  watch-modified: true;
  link: "https://wiki.openstreetmap.org/wiki/Osmose/issues";
}

/* elevation 2020 */
node[natural=peak][!ele], node[mountain_pass=yes][!ele]{
    throwError: "Missing {1.key} tag (elevation)";
    group: tr("elevation - Osmose 2020");
}

/* place without name 6030 */
*[place][!name]{
    throwError: "{0.key} without {1.key}";
    group: tr("place without name - Osmose 6030");
}

/* not-connected highway/cycleway -- OSMOSE Item 1210 */

/* Set connected_node */

way[highway] node:connection {
    set connected_node;
}

/* set nodes in downloaded area */

way[highway] node:in-downloaded-area {
    set downloaded;
}


/* set new_feature */

way[highway] node:new {
    set new_feature;
}


/* Unconnected Cycleway */

way[highway=cycleway]!:closed!.connected_node.downloaded >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking],
way[highway=cycleway]!:closed!.connected_node.downloaded >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking],
way[highway=cycleway]!:closed!.connected_node.new_feature >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking],
way[highway=cycleway]!:closed!.connected_node.new_feature >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking] {
    throwWarning: "Unconnected Cycleway";
    group: tr("Not-connected highway/cycleway -- OSMOSE Item 1210");
}

/* Unconnected Road -- Motorway to Residential */

way[highway=~/^(motorway|trunk|primary|secondary|tertiary|unclassified|residential)$/]!:closed!.connected_node.downloaded >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking][highway!=turning_circle],
way[highway=~/^(motorway|trunk|primary|secondary|tertiary|unclassified|residential)$/]!:closed!.connected_node.downloaded >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking][highway!=turning_circle],
way[highway=~/^(motorway|trunk|primary|secondary|tertiary|unclassified|residential)$/]!:closed!.connected_node.new_feature >[index=-1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking][highway!=turning_circle],
way[highway=~/^(motorway|trunk|primary|secondary|tertiary|unclassified|residential)$/]!:closed!.connected_node.new_feature >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking][highway!=turning_circle] {
    throwWarning: "Unconnected Road";
    group: tr("Not-connected highway/cycleway -- OSMOSE Item 1210");
}

/* 1-member-relation -- OSMOSE Item 1200 */

relation[type] >[index=-1] way {
    set member;
}

relation[type] >[index=1].member way {
    throwWarning: "One Member Relation: Check for other members";
    group: "Osmose Item 1200";
}

 /* Bad link highway -- OSMOSE Item 1110 */ 

/*class 2*/
way[highway*="_link"][eval(waylength()) > 1000] {
    throwWarning: "bad highway link";
    group: tr("highway too long for *_link -- OSMOSE item 1110/2");
}


 /* Bridge to tag -- OSMOSE Item 7012 */
way[bridge=yes][!/^bridge:/][eval(waylength()) > 500] {
    throwWarning: "bridge deserving of more detail use bridge:structure= or bridge:support=; ";
    group: tr("bridge to tag -- OSMOSE Item 7012");
}


/* on junction = roundabout -- OSMOSE Item 4020 */ 

*[junction=roundabout][oneway] {
    throwWarning: "Unnecessary oneway tag";
    group: tr("on junction=roundabout -- OSMOSE Item 4020");
    fixRemove: "oneway";
}

*[junction=roundabout][ref] {
    throwWarning: "Unnecessary ref tag";
    group: tr("on junction=roundabout -- OSMOSE Item 4020");
    fixRemove: "ref";
}

*[junction=roundabout][area] {
    throwWarning: "Unnecessary area tag";
    group: tr("on junction=roundabout -- OSMOSE Item 4020");
    fixRemove: "area";
}

/* Oneway -- OSMOSE Item 2030 */ 


/*-------Class 2-------*/

way[highway] node:connection {
    set highway_node;
}

way[junction=roundabout] node.highway_node {
    set junc_node
}


/* 
Typically does not apply
node[junction=roundabout] < way[highway][!oneway][eval(waylength()) < 100] {
    throwError: "Missing Oneway - Check highway entering/exiting roundabout";
    group: tr("oneway -- OSMOSE Item 2030/2")
}
*/


way[highway][!junction][!oneway][eval(waylength()) < 100]  node.junc_node {
    throwWarning: "Missing Oneway - Check highway entering/exiting roundabout";
    group: tr("oneway -- OSMOSE Item 2030/2")
}



/* ----- Class 20301 ------ */ 
way[cycleway=opposite][!oneway],
way[cycleway=opposite_lane][!oneway] {
    throwWarning: "Opposite cycleway without oneway";
    group: tr("oneway -- OSMOSE Item 2030/20301");
}

/* source -- OSMOSE Item 2040 -- administrative boundary does not contain tag source=* */
way[boundary=administrative][!source]{
    throwError: "administrative boundary does not have source tag";
    group: "source -- OSMOSE Item 2040";
}



/* OSMOSE sudden highway type change -- Item 1090 */

/* ---- SET CLASSES ---- */

way[highway=primary] node:connection {
    set hwy_cont_primary;
}

way[highway=secondary] node:connection {
    set hwy_cont_secondary;
}

way[highway=tertiary] node:connection {
    set hwy_cont_tertiary;
}

way[highway=unclassified] node:connection {
    set hwy_cont_unclassified;
}

way[highway=residential] node:connection,
way[highway=living_street] node:connection {
    set hwy_cont_residential;
}


/* ----  Sudden Highway Type Change Checks ---- */ 

/* Motorway Continuity */
way[highway=motorway].hwy_cont_primary >[index=-1] node,
way[highway=motorway].hwy_cont_primary >[index=1] node {
    throwWarning: "motorway connected to primary road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=motorway].hwy_cont_secondary >[index=-1] node,
way[highway=motorway].hwy_cont_secondary >[index=1] node {
    throwWarning: "motorway connected to secondary road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=motorway].hwy_cont_tertiary >[index=-1] node,
way[highway=motorway].hwy_cont_tertiary >[index=1] node {
    throwWarning: "motorway connected to tertiary road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=motorway].hwy_cont_unclassified >[index=-1] node,
way[highway=motorway].hwy_cont_unclassified >[index=1] node {
    throwWarning: "motorway connected to unclassified road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=motorway].hwy_cont_residential >[index=-1] node,
way[highway=motorway].hwy_cont_residential >[index=1] node {
    throwWarning: "motorway connected to residential road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}


/* Trunk Continuity */
way[highway=trunk].hwy_cont_secondary >[index=-1] node,
way[highway=trunk].hwy_cont_secondary >[index=1] node {
    throwWarning: "trunk connected to secondary road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=trunk].hwy_cont_tertiary >[index=-1] node,
way[highway=trunk].hwy_cont_tertiary >[index=1] node {
    throwWarning: "trunk connected to tertiary road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=trunk].hwy_cont_unclassified >[index=-1] node,
way[highway=trunk].hwy_cont_unclassified >[index=1] node {
    throwWarning: "trunk connected to unclassified road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=trunk].hwy_cont_residential >[index=-1] node,
way[highway=trunk].hwy_cont_residential >[index=1] node {
    throwWarning: "trunk connected to residential road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}


/* Primary Continuity */
way[highway=primary].hwy_cont_tertiary >[index=-1] node,
way[highway=primary].hwy_cont_tertiary >[index=1] node {
    throwWarning: "primary connected to tertiary road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=primary].hwy_cont_unclassified >[index=-1] node,
way[highway=primary].hwy_cont_unclassified >[index=1] node {
    throwWarning: "primary connected to unclassified road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}

way[highway=primary].hwy_cont_residential >[index=-1] node,
way[highway=primary].hwy_cont_residential >[index=1] node {
    throwWarning: "primary connected to residential road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/1");
}


/* Secondary Continuity */
way[highway=secondary].hwy_cont_unclassified >[index=-1] node,
way[highway=secondary].hwy_cont_unclassified >[index=1] node {
    throwWarning: "secondary connected to unclassified road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/2");
}

way[highway=secondary].hwy_cont_residential >[index=-1] node,
way[highway=secondary].hwy_cont_residential >[index=1] node {
    throwWarning: "secondary connected to residential road - check for sudden highway type change";
    group: tr("Sudden highway type change -- OSMOSE Item 1090/2");
}

/* Highway Roundabout OSMOSE Item 3010 */

/*  Class 1 -- Wrong highway on roundabout  */ 
/*---------- SET CLASSES ---------- */

way[highway=primary] node:connection,
way[highway=primary_link] node:connection {
    set primary_junc;
}

way[highway=secondary] node:connection,
way[highway=secondary_link] node:connection {
    set secondary_junc;
}

way[highway=tertiary] node:connection,
way[highway=tertiary_link] node:connection {
    set tertiary_junc;
}

/*---------- VALIDATIONS ---------- */


/*Primary*/
way[highway=secondary][junction=roundabout] node:connection.primary_junc,
way[highway=tertiary][junction=roundabout] node:connection.primary_junc,
way[highway=unclassified][junction=roundabout] node:connection.primary_junc,
way[highway=residential][junction=roundabout] node:connection.primary_junc,
way[highway=living_street][junction=roundabout] node:connection.primary_junc {
    throwWarning: "Wrong highway on roundabout: it must match the highest level of connected routes";
    group: tr("Highway Roundabout -- OSMOSE Item 3010/1");
}

/*Secondary*/
way[highway=tertiary][junction=roundabout] node:connection.secondary_junc,
way[highway=unclassified][junction=roundabout] node:connection.secondary_junc,
way[highway=residential][junction=roundabout] node:connection.secondary_junc,
way[highway=living_street][junction=roundabout] node:connection.secondary_junc {
    throwWarning: "Wrong highway on roundabout: it must match the highest level of connected routes";
    group: tr("Highway Roundabout -- OSMOSE Item 3010/1");
}

/*Tertiary*/
way[highway=unclassified][junction=roundabout] node:connection.tertiary_junc,
way[highway=residential][junction=roundabout] node:connection.tertiary_junc,
way[highway=living_street][junction=roundabout] node:connection.tertiary_junc {
    throwWarning: "Wrong highway on roundabout: it must match the highest level of connected routes";
    group: tr("Highway Roundabout -- OSMOSE Item 3010/1");
}


/*  Class 4 -- Roundabout crossing  */

way[highway][!junction] >[index=-1] node,
way[highway][!junction] >[index=1] node {
    set crossing;
}

way[highway][junction] >[index=-1] node,
way[highway][junction] >[index=1] node {
    set junc_to_junc;
}

way[highway][junction] node:connection!.crossing!.junc_to_junc {
    throwWarning: "Roundabout crossing. way through roundabout without stopping";
    group: tr("Highway Roundabout -- OSMOSE Item 3010/4");
}

Rules_QAToolInspiredValidations.validator.mapcss, Rules_QAToolInspiredValidations.zip

Note: See TracWiki for help on using the wiki.