Skip to content

Commit

Permalink
update flag and challenge instructions (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bentleysb authored Apr 18, 2023
1 parent 3cb97ee commit f7e3e6e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions config/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
"AreasWithHighwayTagCheck":{
"tag.filters":"highway->*&area->yes",
"challenge":{
"description":"A Highway should never be tagged as an area, all these tasks involve highways that have been.",
"blurb":"Highways should not be tagged as Areas.",
"instruction":"Remove highway tag from feature with area tag.",
"description":"Review highways with area tags for accuracy and connectivity.",
"blurb":"Review highways with area tags for accuracy and connectivity.",
"instruction":"Review highways with area tags for accuracy and connectivity.",
"difficulty":"EASY",
"tags":"highway,landuse"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.openstreetmap.atlas.checks.validation.areas;

import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
Expand Down Expand Up @@ -30,9 +29,8 @@
*/
public class AreasWithHighwayTagCheck extends BaseCheck<Long>
{
private static final List<String> FALLBACK_INSTRUCTIONS = Arrays.asList(
"The way with OSM ID {0,number,#} has a highway value of {1}, which should not have an area=yes tag. Consider changing this to highway={2}.",
"The way with OSM ID {0,number,#} has a highway value of {1}, which should not have an area=yes tag.");
private static final List<String> FALLBACK_INSTRUCTIONS = Collections.singletonList(
"The way ID {0,number,#} has an area=yes tag and a highway value of {1}.\nPlease review this feature for accuracy and make updates when necessary.");
private static final long serialVersionUID = 3638306611072651348L;
private static final EnumSet<HighwayTag> VALID_HIGHWAY_TAGS = EnumSet.of(HighwayTag.SERVICES,
HighwayTag.SERVICE, HighwayTag.REST_AREA, HighwayTag.PEDESTRIAN, HighwayTag.PLATFORM);
Expand Down Expand Up @@ -98,7 +96,7 @@ protected Optional<CheckFlag> flag(final AtlasObject object)
final Set<AtlasObject> objectsToFlag = this.getObjectsToFlag(object);
return this
.createFlag(objectsToFlag,
this.getLocalizedInstruction(1, object.getOsmIdentifier(), tag,
this.getLocalizedInstruction(0, object.getOsmIdentifier(), tag,
tag.getTagValue()))
.addFixSuggestions(objectsToFlag.stream()
.map(toFlag -> FeatureChange.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ public void invalidEdgeHighwaySecondary()
@Test
public void invalidHighwayPedestrianNoAreaTag()
{
this.verifier.actual(this.setup.invalidHighwayPedestrianNoAreaTagAtlas(), this.check);
this.verifier.verify(flag -> Assert.assertEquals(flag.getInstructions(),
String.format("Area with OSM ID %s is missing area tag.",
AreasWithHighwayTagCheckTestRule.INVALID_AREA_ID)));
this.verifier.actual(this.setup.invalidAreaHighwayPrimaryTagAtlas(), this.check);
this.verifier.verify(flag -> Assert.assertEquals(flag.getInstructions(), String.format(
"1. The way ID %s has an area=yes tag and a highway value of PRIMARY.\nPlease review this feature for accuracy and make updates when necessary.",
AreasWithHighwayTagCheckTestRule.INVALID_AREA_ID.substring(0,
AreasWithHighwayTagCheckTestRule.INVALID_AREA_ID.length() - 6))));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class AreasWithHighwayTagCheckTestRule extends CoreTestRule
{

public static final String INVALID_AREA_ID = "127005";
public static final String INVALID_AREA_ID = "127005000000";
private static final String AREA_LOCATION_ONE = "37.320524859664474, -122.03601479530336";
private static final String AREA_LOCATION_TWO = "37.320524859664474, -122.03530669212341";
private static final String AREA_LOCATION_THREE = "37.32097706357857, -122.03530669212341";
Expand All @@ -38,10 +38,10 @@ public class AreasWithHighwayTagCheckTestRule extends CoreTestRule

// Flag area with area=yes tag and highway tag not in validHighwayTags
// Same as validHighwayPedestrianTagAtlas, this should not appear in the wild.
@TestAtlas(areas = {
@Area(coordinates = { @Loc(value = AREA_LOCATION_ONE), @Loc(value = AREA_LOCATION_TWO),
@Loc(value = AREA_LOCATION_THREE), @Loc(value = AREA_LOCATION_FOUR),
@Loc(value = AREA_LOCATION_ONE) }, tags = { "highway=primary", "area=yes" }) })
@TestAtlas(areas = { @Area(id = INVALID_AREA_ID, coordinates = {
@Loc(value = AREA_LOCATION_ONE), @Loc(value = AREA_LOCATION_TWO),
@Loc(value = AREA_LOCATION_THREE), @Loc(value = AREA_LOCATION_FOUR),
@Loc(value = AREA_LOCATION_ONE) }, tags = { "highway=primary", "area=yes" }) })
private Atlas invalidAreaHighwayPrimaryTagAtlas;

// Area with invalid highway=footway tag
Expand Down

0 comments on commit f7e3e6e

Please sign in to comment.