Skip to content
Permalink
Browse files
change tagging from source:maxspeed=something to maxspeed:type=someth…
…ing (#492)

also, change lit quest to respect all three different keys for the same thing
  • Loading branch information
westnordost committed Oct 13, 2017
1 parent a693b47 commit c7c9537657ceba3959915739d06cd752bf542c94
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
@@ -8,27 +8,29 @@

public class AddMaxSpeedTest extends AOsmElementQuestTypeTest
{
private static final String MAXSPEED_TYPE = "maxspeed:type";

public void testNoSign()
{
bundle.putString(AddMaxSpeedForm.MAX_SPEED_IMPLICIT_ROADTYPE, "flubberway");
bundle.putString(AddMaxSpeedForm.MAX_SPEED_IMPLICIT_COUNTRY, "XX");
verify(new StringMapEntryAdd("source:maxspeed","XX:flubberway"));
verify(new StringMapEntryAdd(MAXSPEED_TYPE,"XX:flubberway"));
}

public void testNormalSign()
{
bundle.putString(AddMaxSpeedForm.MAX_SPEED, "123");
verify(
new StringMapEntryAdd("maxspeed","123"),
new StringMapEntryAdd("source:maxspeed","sign"));
new StringMapEntryAdd(MAXSPEED_TYPE,"sign"));
}

public void testAdvisoryNormalSign()
{
bundle.putString(AddMaxSpeedForm.ADVISORY_SPEED, "123");
verify(
new StringMapEntryAdd("maxspeed:advisory","123"),
new StringMapEntryAdd("source:maxspeed:advisory","sign"));
new StringMapEntryAdd(MAXSPEED_TYPE+":advisory","sign"));
}

public void testZoneSign()
@@ -38,7 +40,7 @@ public void testZoneSign()
bundle.putString(AddMaxSpeedForm.MAX_SPEED_IMPLICIT_COUNTRY, "AA");
verify(
new StringMapEntryAdd("maxspeed","123"),
new StringMapEntryAdd("source:maxspeed","AA:zoneXYZ"));
new StringMapEntryAdd(MAXSPEED_TYPE,"AA:zoneXYZ"));
}

public void testLivingStreet()
@@ -14,6 +14,8 @@

public class AddMaxSpeed extends SimpleOverpassQuestType
{
private static final String MAXSPEED_TYPE = "maxspeed:type";

@Inject public AddMaxSpeed(OverpassMapDataDao overpassServer) { super(overpassServer); }

@Override protected String getTagFilters()
@@ -42,7 +44,7 @@ public class AddMaxSpeed extends SimpleOverpassQuestType
else if(advisory != null)
{
changes.add("maxspeed:advisory", advisory);
changes.add("source:maxspeed:advisory", "sign");
changes.add(MAXSPEED_TYPE+":advisory", "sign");
}
else
{
@@ -54,11 +56,11 @@ else if(advisory != null)
String roadtype = answer.getString(AddMaxSpeedForm.MAX_SPEED_IMPLICIT_ROADTYPE);
if (roadtype != null && country != null)
{
changes.add("source:maxspeed", country + ":" + roadtype);
changes.add(MAXSPEED_TYPE, country + ":" + roadtype);
}
else if (maxspeed != null)
{
changes.add("source:maxspeed", "sign");
changes.add(MAXSPEED_TYPE, "sign");
}
}
}
@@ -39,16 +39,20 @@ public class AddWayLit extends SimpleOverpassQuestType

return "ways with " +
"(" +
" highway ~ " + TextUtils.join("|", LIT_RESIDENTIAL_ROADS) +
" or" +
" highway ~ " + TextUtils.join("|", LIT_NON_RESIDENTIAL_ROADS) +
" and ( sidewalk ~ both|left|right|yes|separate or source:maxspeed ~ .+:urban )" +
" or" +
" highway ~ " + TextUtils.join("|", LIT_WAYS) +
" or" +
" highway = path and (foot = designated or bicycle = designated)" +
" highway ~ " + TextUtils.join("|", LIT_RESIDENTIAL_ROADS) +
" or" +
" highway ~ " + TextUtils.join("|", LIT_NON_RESIDENTIAL_ROADS) + " and" +
" (" +
" sidewalk ~ both|left|right|yes|separate" +
" or source:maxspeed ~ .+:urban or maxspeed:type ~ .+:urban or zone:maxspeed ~ .+:urban" +
" )" +
" or" +
" highway ~ " + TextUtils.join("|", LIT_WAYS) +
" or" +
" highway = path and (foot = designated or bicycle = designated)" +
")" +
" and !lit and (access !~ private|no or (foot and foot !~ private|no))";
" and !lit" +
" and (access !~ private|no or (foot and foot !~ private|no))"; // not private roads
}

public AbstractQuestAnswerFragment createForm()

0 comments on commit c7c9537

Please sign in to comment.