fix for issue #18: adm0_l and adm0_r at z4 (#53)

* testCountryLeftRightName() extended to cover adm0_{l,r} not showing up at Z4

* fix for #18 + alignment with OMT: adm0_{l,r} only for non-disputed and only from z5

* clean-up: if-else simplified since same for z4

* other tests updated to match adm0_{l,r} change
This commit is contained in:
Peter Hanecak
2022-12-05 12:48:14 +01:00
committed by GitHub
parent e33b2bd2fe
commit d378521372
2 changed files with 57 additions and 22 deletions

View File

@@ -312,16 +312,22 @@ public class Boundary implements
BorderingRegions borderingRegions = getBorderingRegions(countryBoundaries, key.regions, lineString);
var features = featureCollectors.get(SimpleFeature.fromWorldGeometry(lineString));
features.line(LAYER_NAME).setBufferPixels(BUFFER_SIZE)
var newFeature = features.line(LAYER_NAME).setBufferPixels(BUFFER_SIZE)
.setAttr(Fields.ADMIN_LEVEL, key.adminLevel)
.setAttr(Fields.DISPUTED, key.disputed ? 1 : 0)
.setAttr(Fields.MARITIME, key.maritime ? 1 : 0)
.setAttr(Fields.CLAIMED_BY, key.claimedBy)
.setAttr(Fields.DISPUTED_NAME, key.disputed ? editName(key.name) : null)
.setAttr(Fields.ADM0_L, borderingRegions.left == null ? null : regionNames.get(borderingRegions.left))
.setAttr(Fields.ADM0_R, borderingRegions.right == null ? null : regionNames.get(borderingRegions.right))
.setMinPixelSizeAtAllZooms(0)
.setMinZoom(key.minzoom);
if (key.adminLevel == 2 && !key.disputed) {
// only non-disputed admin 2 boundaries get to have adm0_{l,r}, at zoom 5 and more
newFeature
.setAttrWithMinzoom(Fields.ADM0_L,
borderingRegions.left == null ? null : regionNames.get(borderingRegions.left), 5)
.setAttrWithMinzoom(Fields.ADM0_R,
borderingRegions.right == null ? null : regionNames.get(borderingRegions.right), 5);
}
for (var feature : features) {
emit.accept(feature);
}