Skip to content

Commit

Permalink
Boundaries: make disputed boolean consistent [#190]
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Dec 28, 2023
1 parent eca4d11 commit 6b56eb7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {

// Core Tilezen schema properties
if (disputed.getAsInt() == 1) {
line.setAttr("disputed", 1);
line.setAttr("disputed", true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,41 @@ void testUntaggedWay() {
List.of(Map.of("pmap:kind", "country")),
collector);
}

@Test
void testDisputedNe() {
var way = SimpleFeature.create(newLineString(0, 0, 1, 1), new HashMap<>(Map.of(
"featurecla", "Disputed (please verify)", "min_zoom", 0)), "ne", "ne_10m_admin_0_boundary_lines_land", 123);

var collector = featureCollectorFactory.get(way);
profile.processFeature(way, collector);

assertFeatures(12,
List.of(Map.of("disputed", true)),
collector);
}

@Test
void testDisputedOsm() {
var infos = profile.preprocessOsmRelation(
new OsmElement.Relation(1, Map.of("type", "boundary", "boundary", "disputed", "admin_level", "2"),
List.of(new OsmElement.Relation.Member(OsmElement.Type.WAY, 123, ""))));

var way = SimpleFeature.createFakeOsmFeature(
newLineString(0, 0, 1, 1),
new HashMap<>(Map.of(
)),
"osm",
null,
123,
infos.stream().map(r -> new OsmReader.RelationMember<>("", r)).toList()
);

var collector = featureCollectorFactory.get(way);
profile.processFeature(way, collector);

assertFeatures(12,
List.of(Map.of("disputed", true)),
collector);
}
}

0 comments on commit 6b56eb7

Please sign in to comment.