Skip to content

Commit

Permalink
merge natural layer into landuse layer [#282]
Browse files Browse the repository at this point in the history
  • Loading branch information
bdon committed Sep 20, 2024
1 parent c646c13 commit 6456824
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 95 deletions.
16 changes: 8 additions & 8 deletions styles/src/base_layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ export function nolabels_layers(
},
},
{
id: "natural_wood",
id: "landuse_wood",
type: "fill",
source: source,
"source-layer": "natural",
"source-layer": "landuse",
filter: ["any", ["in", "kind", "wood", "nature_reserve", "forest"]],
paint: {
"fill-color": [
Expand All @@ -154,10 +154,10 @@ export function nolabels_layers(
},
},
{
id: "natural_scrub",
id: "landuse_scrub",
type: "fill",
source: source,
"source-layer": "natural",
"source-layer": "landuse",
filter: ["in", "kind", "scrub", "grassland", "grass"],
paint: {
"fill-color": [
Expand All @@ -172,20 +172,20 @@ export function nolabels_layers(
},
},
{
id: "natural_glacier",
id: "landuse_glacier",
type: "fill",
source: source,
"source-layer": "natural",
"source-layer": "landuse",
filter: ["==", "kind", "glacier"],
paint: {
"fill-color": t.glacier,
},
},
{
id: "natural_sand",
id: "landuse_sand",
type: "fill",
source: source,
"source-layer": "natural",
"source-layer": "landuse",
filter: ["==", "kind", "sand"],
paint: {
"fill-color": t.sand,
Expand Down
7 changes: 1 addition & 6 deletions tiles/src/main/java/com/protomaps/basemap/Basemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.protomaps.basemap.layers.Earth;
import com.protomaps.basemap.layers.Landcover;
import com.protomaps.basemap.layers.Landuse;
import com.protomaps.basemap.layers.Natural;
import com.protomaps.basemap.layers.PhysicalLine;
import com.protomaps.basemap.layers.PhysicalPoint;
import com.protomaps.basemap.layers.Places;
Expand Down Expand Up @@ -47,10 +46,6 @@ public Basemap(NaturalEarthDb naturalEarthDb, QrankDb qrankDb) {
registerHandler(landcover);
registerSourceHandler("landcover", landcover::processLandcover);

var natural = new Natural();
registerHandler(natural);
registerSourceHandler("osm", natural::processOsm);

var physicalLine = new PhysicalLine();
registerHandler(physicalLine);
registerSourceHandler("osm", physicalLine::processOsm);
Expand Down Expand Up @@ -171,7 +166,7 @@ static void run(Arguments args) {

fontRegistry.loadFontBundle("NotoSansDevanagari-Regular", "1", "Devanagari");

planetiler.setProfile(new Basemap(naturalEarthDb, qrankDb)).setOutput(Path.of(area + ".pmtiles"))
planetiler.setProfile(new Basemap(naturalEarthDb, qrankDb)).setOutput(Path.of(area + ".mbtiles"))
.run();
}
}
4 changes: 2 additions & 2 deletions tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
sf.hasTag("amenity", "hospital", "school", "kindergarten", "university", "college") ||
sf.hasTag("boundary", "national_park", "protected_area") ||
sf.hasTag("landuse", "recreation_ground", "industrial", "brownfield", "railway", "cemetery", "commercial",
"grass", "orchard", "farmland", "farmyard", "residential", "military", "village_green", "allotments") ||
"grass", "orchard", "farmland", "farmyard", "residential", "military", "village_green", "allotments", "forest", "meadow", "grass") ||
sf.hasTag("leisure", "park", "garden", "golf_course", "dog_park", "playground", "pitch", "nature_reserve") ||
sf.hasTag("man_made", "pier", "bridge") ||
sf.hasTag("natural", "beach") ||
sf.hasTag("natural", "beach", "wood", "glacier", "grass", "scrub", "sand", "wetland", "bare_rock") ||
// TODO: (nvkelso 20230622) This use of the place tag here is dubious, though paired with "residential"
sf.hasTag("place", "neighbourhood") ||
sf.hasTag("railway", "platform") ||
Expand Down
55 changes: 0 additions & 55 deletions tiles/src/main/java/com/protomaps/basemap/layers/Natural.java

This file was deleted.

13 changes: 13 additions & 0 deletions tiles/src/test/java/com/protomaps/basemap/layers/LanduseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,17 @@ void landuseAllotments() {
0
)));
}

@Test
void landuseGlacier() {
assertFeatures(15,
List.of(Map.of("kind", "glacier")),
process(SimpleFeature.create(
newPolygon(0, 0, 0, 1, 1, 1, 0, 0),
new HashMap<>(Map.of("natural", "glacier")),
"osm",
null,
0
)));
}
}
24 changes: 0 additions & 24 deletions tiles/src/test/java/com/protomaps/basemap/layers/NaturalTest.java

This file was deleted.

0 comments on commit 6456824

Please sign in to comment.