Skip to content

Commit

Permalink
Merge pull request #49 from phanecak-maptiler/fix_sudan_border
Browse files Browse the repository at this point in the history
Fix borders z0-z4
  • Loading branch information
phanecak-maptiler authored Mar 27, 2024
2 parents 8911cb8 + 567c6c5 commit c04b0aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/openmaptiles/layers/Boundary.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,17 @@ record BoundaryInfo(int adminLevel, int minzoom, int maxzoom) {}
BoundaryInfo info = switch (table) {
case "ne_110m_admin_0_boundary_lines_land" -> new BoundaryInfo(2, 0, 0);
case "ne_50m_admin_0_boundary_lines_land" -> new BoundaryInfo(2, 1, 3);
case "ne_10m_admin_0_boundary_lines_land" -> feature.hasTag("featurecla", "Lease limit") ? null :
new BoundaryInfo(2, 4, 4);
case "ne_10m_admin_0_boundary_lines_land" -> {
boolean isDisputedSouthSudanAndKenya = false;
if (disputed) {
String left = feature.getString("adm0_left");
String right = feature.getString("adm0_right");
isDisputedSouthSudanAndKenya = "South Sudan".equals(left) && "Kenya".equals(right);
}
yield isDisputedSouthSudanAndKenya ? new BoundaryInfo(2, 1, 4) :
feature.hasTag("featurecla", "Lease limit") ? null :
new BoundaryInfo(2, 4, 4);
}
case "ne_10m_admin_1_states_provinces_lines" -> {
Double minZoom = Parse.parseDoubleOrNull(feature.getTag("min_zoom"));
yield minZoom != null && minZoom <= 7 ? new BoundaryInfo(4, 1, 4) :
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/org/openmaptiles/layers/BoundaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void testNaturalEarthCountryBoundaries() {
assertFeatures(0, List.of(Map.of(
"_layer", "boundary",
"_type", "line",
"_minzoom", 4,
"admin_level", 2
)), process(SimpleFeature.create(
newLineString(0, 0, 1, 1),
Expand All @@ -115,6 +116,23 @@ void testNaturalEarthCountryBoundaries() {
0
)));

assertFeatures(0, List.of(Map.of(
"_layer", "boundary",
"_type", "line",
"_minzoom", 1,
"admin_level", 2
)), process(SimpleFeature.create(
newLineString(0, 0, 1, 1),
Map.of(
"featurecla", "Disputed (please verify)",
"adm0_left", "South Sudan",
"adm0_right", "Kenya"
),
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
"ne_10m_admin_0_boundary_lines_land",
0
)));

assertFeatures(0, List.of(), process(SimpleFeature.create(
newLineString(0, 0, 1, 1),
Map.of(
Expand Down

0 comments on commit c04b0aa

Please sign in to comment.