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

/* tagwatch cleaner 3030 deprecated Tags --- partially complete*/


*[amenity=chapel]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "amenity=place_of_worship, religion=christian";
    fixAdd: "amenity=place_of_worship";
    fixAdd: "religion=christian";
}

*[amenity = bakery]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=bakery";
    fixAdd: "shop=bakery";
    fixRemove: "amenity"
}

*[amenity = chocolatier]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=chocolatier";
    fixAdd: "shop=chocolatier";
    fixRemove: "amenity"
}

*[amenity = dry_cleaning]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=dry_cleaning";
    fixAdd: "shop=dry_cleaning";
    fixRemove: "amenity"
}

*[amenity = emergency_phone]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "emergency=phone";
    fixAdd: "emergency=phone";
    fixRemove: "amenity"
}


*[amenity = florist],
*[shop = floristry],
*[shop = flower],
*[shop = flowers] {
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=florist";
    fixAdd: "shop=florist";
    fixRemove: "amenity"
}


*[amenity = butcher],
*[shop = butchers] {
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=butcher";
    fixAdd: "shop=butcher";
    fixRemove: "amenity"
}


*[shop *= "car school"],
*[shop = car_school],
*[shop *= "driver's education"],
*[shop *= "driving school"],
*[shop *= "driver education"] {
  throwWarning: tr("{0}", "{0.tag}");
  suggestAlternative: "shop=driving_school";
  fixAdd: "shop=driving_school";
}


*[shop=bakers]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=bakery";
    fixAdd: "shop=bakery";
}

*[shop = garden],
*[shop *= "garden shop"],
*[shop = garden_center],
*[shop = gardening]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose tagwatch cleaner 3030");
    suggestAlternative: "shop=garden_centre";
    fixAdd: "shop=garden_centre"
}

/* Deprecated Tags-- OSMOSE disused Item 4010*/
/* For deprecated tags not already found by JOSM */

*[aerialway=canopy]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "aerialway=zip_line";
    fixAdd: "aerialway=zipline";
}

*[amenity=abandoned]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "abandoned:amenity=*"
}

*[amenity=citymap_post]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "tourism=information";
    fixRemove: "amenity";
    fixAdd: "tourism=information";
}

*[amenity=creche]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "amenity=childcare or amenity=kindergarten"
}

*[amenity=ev_charging],
*[amenity=charging]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "amenity=charging_station";
    fixRemove: "amenity";
    fixAdd: "amenity=charging_station";
}

*[amenity=fire_hydrant]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "emergency=fire_hydrant";
    fixRemove: "amenity";
    fixAdd: "emergency=fire_hydrant";
}

*[amenity=garages],
*[amenity=garage]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "amenity=parking + parking=* or landuse=garages";
}

*[amenity=nursery]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "amenity=childcare or amenity=kindergarten";
}

*[amenity=preschool]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "amenity=kindergarten";
    fixAdd: "amenity=kindergarten";
}

*[amenity=real_estate]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "office=estate_agent";
    fixRemove: "amenity";
    fixAdd: "office=estate_agent";
}

*[office=real_estate]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "office=estate_agent";
    fixAdd: "office=estate_agent";
}

*[shop=real_estate]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "office=estate_agent";
    fixRemove: "shop";
    fixAdd: "office=estate_agent";
}

*[amenity=sauna]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "leisure=sauna";
    fixRemove: "amenity";
    fixAdd: "leisure=sauna";
}

*[amenity=winery]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "shop=winery or craft=winery";
}

*[amenity=youth_centre],
*[amenity=youth_center]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "amenity=community_centre + community_centre:for=juvenile or community_centre:for=child;juvenile";
}

*[bridge=arch],
*[bridge=beam],
*[bridge=humpback],
*[bridge=suspension]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "bridge=yes + bridge:structure={0.value}";
    fixAdd: "bridge=yes";
    fixAdd: "bridge:structure={0.value}";
}

*[bridge=lift],
*[bridge=swing]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "bridge=movable + bridge:structure={0.value}";
    fixAdd: "bridge=movable";
    fixAdd: "bridge:structure={0.value}";
}

*[bridge=pontoon]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "bridge=yes + bridge:structure=floating";
    fixAdd: "bridge=yes";
    fixAdd: "bridge:structure=floating";
}

*[building:type]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "building=*";
}

*[escalator]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "highway=steps + conveying=*";
}

*[fenced]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "barrier=fence";
    fixRemove: "fenced";
    fixAdd: "barrier=fence";
}

*[highway=abandoned]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "abandoned:highway=*";
}

*[highway=minor]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "highway=tertiary or highway=unclassified or highway=service";
}

*[historic_name]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "old_name=* or name=*";
}

*[historic=museum]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "tourism=museum";
    fixRemove: "historic";
    fixAdd: "tourism=museum";
}

*[landuse=field]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "landuse=farmland";
    fixAdd: "landuse=farmland";
}

*[leisure=beach]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "natural=beach";
    fixRemove: "leisure";
    fixAdd: "natural=beach";
}

*[leisure=club]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "club=*";
}

*[leisure=video_arcade]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "leisure=adult_gaming_centre or leisure=amusement_arcade";
}

*[man_made=cooling_tower]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "man_made=tower + tower:type=cooling";
    fixAdd: "man_made=tower";
    fixAdd: "tower:type=cooling";
}
*[man_made=hot_water_tank]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "man_made=storage_tank + content=hot_water";
    fixAdd: "man_made=storage_tank";
    fixAdd: "content=hot_water";
}
*[man_made=jetty]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "man_made=pier";
    fixAdd: "man_made=pier";
}

*[man_made=village_pump]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "man_made=water_well";
    fixAdd: "man_made=water_well";
}

*[man_made=water_tank]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "man_made=storage_tank + content=water";
    fixAdd: "man_made=storage_tank";
    fixAdd: "content=water";
}

*[natural=moor]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
}

*[noexit=no]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "fixme=continue";
}

*[office=administrative]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "office=government";
    fixAdd: "office=government";
}
*[power=underground_cable]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "power=cable + location=underground";
    fixAdd: "power=cable";
    fixAdd: "location=underground";
}

*[railway=preserved]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "historic=railway + railway= + railway:preserved=yes";
}

*[shop=dive]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "shop=scuba_diving";
    fixAdd: "shop=scuba_diving";
}
*[shop=furnace]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "shop=fireplace or shop=houseware";
}

*[shop=moneylender]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "shop=money_lender";
    fixAdd: "shop=money_lender";
}

*[sport=paragliding]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "sport=free_flying";
    fixAdd: "sport=free_flying";
}

*[tourism=bed_and_breakfast]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "tourism=guest_house + guest_house=bed_and_breakfast";
    fixAdd: "tourism=guest_house";
    fixAdd: "guest_house=bed_and_breakfast";
}

*[wood]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "leaf_type=*";
}

*[man_made=MDF],
*[man_made=mdf]{
    throwWarning: "{0.tag} is deprecated";
    group: tr("deprecated tagging - Osmose disused 4010");
    suggestAlternative: "telecom=exchange";
    fixRemove: "man_made";
    fixAdd: "telecom=exchange";
}

/* 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_OsmoseValidations.validator.mapcss, Rules_OsmoseValidations.zip

Last modified 7 days ago Last modified on 2019-02-12T21:46:26+01:00