wiki:Rules/QAToolInspiredValidations

Version 25 (modified by dmanzer95, 5 years ago) ( diff )

--

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

    
/* Overlapping building - OSMOSE Item 0 - Class 3 building too small */ 

way[building][eval(areasize() < 0.25)] {
    throwWarning: tr("0/3: Building too small");
    group: "OSMOSE";
}

/* 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: tr("Unconnected Cycleway");
    -osmoseItemClassLevel: "1210/1/1";
    -osmoseTags: list("highway", "cycleway", "fix:chair");
    group: "OSMOSE 1210 - not-connected highway/cycleway";
}

/* Unconnected Road -- Motorway to Residential */

way[highway=~/^(motorway|trunk|primary|secondary|tertiary|unclassified)$/]!: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)$/]!: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)$/]!: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)$/]!:closed!.connected_node.new_feature >[index=1] node[noexit!=yes][amenity!=parking_entrance][amenity!=parking][highway!=turning_circle] {
    throwWarning: tr("Unconnected Highway");
    -osmoseItemClassLevel: "1210/2/1";
    -osmoseTags: list("highway", "fix:chair");
    group: "OSMOSE 1210 - not-connected highway/cycleway";
}

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

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

relation[type][type!~/^(defaults|route|route_master|associatedStreet)$/][site!=geodesic][restriction!=no_u_turn] >[index=1].member way {
    throwWarning: tr("1200: One Member Relation; Check for other members or remove relation");
    -osmoseItemClassLevel: "1200/12001:1/2";
    -osmoseTags: list("relation", "fix:chair");
    group: "OSMOSE 1200 - 1-member relation";
}

/* Objects Overlap -- OSMOSE item 1070 - Class 2 */
node[natural=tree]  area[building] {
  throwWarning: tr("1070/2: Tree inside {0}", "{0.key}");
  group: "OSMOSE";
}

/* Tree type -- OSMOSE item 3120 */
node[natural=tree][!type] {
  throwOther: tr("3120: {0} without {1} tag", "{0.tag}", "{1.key}");
  group: "OSMOSE";
}

/* Tree species -- OSMOSE item 3120 */
node[natural=tree][!/^species:/] {
  throwOther: tr("3120: {0} without species tag", "{0.tag}");
  group: "OSMOSE";
}

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

way[highway*="_link"][highway!~/^(motorway_link|trunk_link)$/][eval(waylength()) > 1000] {
    throwWarning: tr("Highway too long for a *_link");
    -osmoseItemClassLevel: "1110/2/1";
    -osmoseTags: list("relation", "fix:chair");
    group: "OSMOSE 1110 - bad *_link highway";
}

 /* Bridge to tag -- OSMOSE Item 7012 */

way[bridge=yes][highway!~/^(motorway|trunk|primary|secondary)$/][!/^bridge:/][eval(waylength()) > 500],
way[bridge=yes][railway][!/^bridge:/][eval(waylength()) > 500] {
    throwOther: tr("Bridge structure missing");
    -osmoseItemClassLevel: "7012/1/3";
    -osmoseTags: list("tag", "highway", "fix:survey");
    group: "OSMOSE 7012 - bridge to tag";
}

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

way[junction=roundabout][oneway] {
    throwOther: tr("Unnecessary oneway tag");
    -osmoseItemClassLevel: "4020/101/3";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE 4020 - on junction=roundabout";
    fixRemove: "oneway";
}

way[junction=roundabout][ref][inside("FR,NC")] {
    throwWarning: tr("Should not contain tag ref={0}", "{1.value}");
    -osmoseItemClassLevel: "4020/102/2";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE 4020 - on junction=roundabout";
    fixRemove: "ref";
}

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

/* Oneway -- OSMOSE Item 2030 */ 

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: tr("2030/2: Missing Oneway - Check highway entering/exiting roundabout");
    group: tr("OSMOSE");
}
*/

way[highway=footway] node:connection,
way[highway=pedestrian] node:connection,
way[highway=cycleway] node:connection,
way[highway=path] node:connection {
    set excluded;
}

way[highway][!junction][!oneway][eval(waylength()) < 100]  node.junc_node!.excluded {
    throwWarning: tr("Missing Oneway");
    -osmoseItemClassLevel: "2030/2/2";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE";
}

way[cycleway=opposite][!oneway],
way[cycleway=opposite_lane][!oneway] {
    throwError: tr("Opposite cycleway without oneway");
    -osmoseItemClassLevel: "2030/20301/1";
    -osmoseTags: list("tag", "highway", "cycleway", "fix:survey");
    group: "OSMOSE 2030 - oneway";
}

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


/* Highway Roundabout OSMOSE Item 3010 */

/*---------- 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: tr("Wrong highway on roundabout");
    -osmoseItemClassLevel: "3010/1/2";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE 3010 - highway roundabout";
}

/*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: tr("Wrong highway on roundabout");
    -osmoseItemClassLevel: "3010/1/2";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE 3010 - highway roundabout";
}

/*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: tr("Wrong highway on roundabout");
    -osmoseItemClassLevel: "3010/1/2";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE 3010 - highway roundabout";
}

/*      Roundabout crossing     */

way[highway=footway] node:connection,
way[highway=pedestrian] node:connection,
way[highway=cycleway] node:connection,
way[highway=path] node:connection,
way[landuse] node:connection,
way[natural] node:connection {
    set excluded2;
}

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=roundabout] node:connection!.crossing!.junc_to_junc!.excluded2 {
    throwWarning: tr("Roundabout crossing");
    -osmoseItemClassLevel: "3010/4/2";
    -osmoseTags: list("highway", "roundabout", "fix:chair");
    group: "OSMOSE 3010 - highway roundabout";
}   

Rules_QAToolInspiredValidations.validator.mapcss, Rules_QAToolInspiredValidations.zip

Note: See TracWiki for help on using the wiki.