Skip to content

Commit

Permalink
tiles 3.5.1
Browse files Browse the repository at this point in the history
* order landcover by kind consistently in tileset [#154]
  • Loading branch information
bdon committed Apr 6, 2024
1 parent e8873fc commit 2cb96a7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Tiles v3.5.1
------
- Order landcover by kind consistently [#154]

Tiles v3.5.0
------
- Add Daylight Landcover from zooms 0-7. [#154]
Expand Down
2 changes: 1 addition & 1 deletion tiles/src/main/java/com/protomaps/basemap/Basemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public String description() {

@Override
public String version() {
return "3.5.0";
return "3.5.1";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ public class Landcover implements ForwardingProfile.FeaturePostProcessor {
static final Map<String, String> kindMapping = Map.of("urban", "urban_area", "crop", "farmland", "grass", "grassland",
"trees", "forest", "snow", "glacier", "shrub", "scrub", "barren", "barren");

static final Map<String, Integer> sortKeyMapping = Map.of("barren",0, "snow", 1, "crop", 2, "shrub", 3, "grass", 4, "forest", 5);

public void processLandcover(SourceFeature sf, FeatureCollector features) {
String kind = kindMapping.getOrDefault(sf.getString("class"), "unknown");

// polygons are disjoint and non-overlapping, but order them in archive in consistent way
Integer sortKey = sortKeyMapping.getOrDefault(sf.getString("class"), 6);

features.polygon(this.name())
.setId(FeatureId.create(sf))
.setAttr("pmap:kind", kind)
.setZoomRange(0, 7)
.setSortKey(sortKey)
.setMinPixelSize(0.0);
}

Expand Down

0 comments on commit 2cb96a7

Please sign in to comment.