Skip to content

Commit 55d0df2

Browse files
authored
tiles 4.0.0-alpha.4 [#282] (#296)
* breaking change: remove pmap: prefixes from tiles. * breaking change: remove physical_point, natural and physical_line layers. * move features into landuse, water, pois and earth.
1 parent dec9f03 commit 55d0df2

29 files changed

+401
-550
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Tiles v4.0.0-alpha.3
2+
------
3+
- remove all `pmap:` prefixes (breaking change) [#282]
4+
- remove `physical_point`, `natural` and `physical_line` layers.
5+
- move into `landuse`, `water`, `pois` and `earth` layers to align with Tilezen.
6+
- Some layers are now mixed geometry types.
7+
18
Styles v4.0.0-alpha.0
29
------
310
- Add lang and script parameters to TypeScript style generation [#275]

tiles/src/main/java/com/protomaps/basemap/Basemap.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
import com.protomaps.basemap.layers.Earth;
1212
import com.protomaps.basemap.layers.Landcover;
1313
import com.protomaps.basemap.layers.Landuse;
14-
import com.protomaps.basemap.layers.Natural;
15-
import com.protomaps.basemap.layers.PhysicalLine;
16-
import com.protomaps.basemap.layers.PhysicalPoint;
1714
import com.protomaps.basemap.layers.Places;
1815
import com.protomaps.basemap.layers.Pois;
1916
import com.protomaps.basemap.layers.Roads;
@@ -47,19 +44,6 @@ public Basemap(NaturalEarthDb naturalEarthDb, QrankDb qrankDb) {
4744
registerHandler(landcover);
4845
registerSourceHandler("landcover", landcover::processLandcover);
4946

50-
var natural = new Natural();
51-
registerHandler(natural);
52-
registerSourceHandler("osm", natural::processOsm);
53-
54-
var physicalLine = new PhysicalLine();
55-
registerHandler(physicalLine);
56-
registerSourceHandler("osm", physicalLine::processOsm);
57-
58-
var physicalPoint = new PhysicalPoint();
59-
registerHandler(physicalPoint);
60-
registerSourceHandler("osm", physicalPoint::processOsm);
61-
registerSourceHandler("ne", physicalPoint::processNe);
62-
6347
var place = new Places(naturalEarthDb);
6448
registerHandler(place);
6549
registerSourceHandler("osm", place::processOsm);
@@ -84,6 +68,8 @@ public Basemap(NaturalEarthDb naturalEarthDb, QrankDb qrankDb) {
8468

8569
var earth = new Earth();
8670
registerHandler(earth);
71+
72+
registerSourceHandler("osm", earth::processOsm);
8773
registerSourceHandler("osm_land", earth::processPreparedOsm);
8874
registerSourceHandler("ne", earth::processNe);
8975
}
@@ -100,7 +86,7 @@ public String description() {
10086

10187
@Override
10288
public String version() {
103-
return "4.0.0-alpha.3";
89+
return "4.0.0-alpha.4";
10490
}
10591

10692
@Override
@@ -111,7 +97,7 @@ public boolean isOverlay() {
11197
@Override
11298
public String attribution() {
11399
return """
114-
<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>
100+
<a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a>
115101
""".trim();
116102
}
117103

tiles/src/main/java/com/protomaps/basemap/layers/Boundaries.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ public void processNe(SourceFeature sf, FeatureCollector features) {
143143

144144
var line = features.line(this.name())
145145
// Core Tilezen schema properties
146-
.setAttr("pmap:kind", kind)
146+
.setAttr("kind", kind)
147147
// Don't label lines to reduce file size (and they aren't shown in styles anyhow)
148148
//.setAttr("name", sf.getString("name"))
149149
// Preview v4 schema (disabled)
150-
//.setAttr("pmap:min_zoom", sf.getLong("min_zoom"))
151-
.setAttr("pmap:min_admin_level", adminLevel)
150+
//.setAttr("min_zoom", sf.getLong("min_zoom"))
151+
.setAttr("min_admin_level", adminLevel)
152152
// Reduce file size at low zooms
153-
//.setAttr("pmap:ne_id", sf.getString("ne_id"))
154-
.setAttr("pmap:brk_a3", sf.getString("brk_a3"))
153+
//.setAttr("ne_id", sf.getString("ne_id"))
154+
.setAttr("brk_a3", sf.getString("brk_a3"))
155155
.setZoomRange(
156156
sf.getString("min_zoom") == null ? themeMinZoom : (int) minZoom,
157157
themeMaxZoom)
@@ -161,7 +161,7 @@ public void processNe(SourceFeature sf, FeatureCollector features) {
161161

162162
// Core Tilezen schema properties
163163
if (!kindDetail.isEmpty()) {
164-
line.setAttr("pmap:kind_detail", kindDetail);
164+
line.setAttr("kind_detail", kindDetail);
165165
}
166166

167167
if (disputed) {
@@ -238,16 +238,16 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
238238
var line = features.line(this.name())
239239
.setId(FeatureId.create(sf))
240240
// Core Tilezen schema properties
241-
.setAttr("pmap:kind", kind)
242-
.setAttr("pmap:min_admin_level", minAdminLevel.getAsInt())
241+
.setAttr("kind", kind)
242+
.setAttr("min_admin_level", minAdminLevel.getAsInt())
243243
.setMinPixelSize(0)
244244
// Preview v4 schema (disabled)
245-
//.setAttr("pmap:min_zoom", min_zoom)
245+
//.setAttr("min_zoom", min_zoom)
246246
.setMinZoom(themeMinZoom);
247247

248248
// Core Tilezen schema properties
249249
if (!kindDetail.isEmpty()) {
250-
line.setAttr("pmap:kind_detail", kindDetail);
250+
line.setAttr("kind_detail", kindDetail);
251251
}
252252

253253
// Core Tilezen schema properties

tiles/src/main/java/com/protomaps/basemap/layers/Buildings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
7676
var feature = features.polygon(this.name())
7777
.setId(FeatureId.create(sf))
7878
// Core Tilezen schema properties
79-
.setAttr("pmap:kind", kind)
79+
.setAttr("kind", kind)
8080
// Core OSM tags for different kinds of places
8181
.setAttrWithMinzoom("layer", Parse.parseIntOrNull(sf.getString("layer")), 13)
8282
// NOTE: Height is quantized by zoom in a post-process step
@@ -85,7 +85,7 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
8585

8686
if (kind.equals("building_part")) {
8787
// We don't need to set WithMinzoom because that's implicate with the ZoomRange
88-
feature.setAttr("pmap:kind_detail", sf.getString("building:part"));
88+
feature.setAttr("kind_detail", sf.getString("building:part"));
8989
feature.setAttr(MIN_HEIGHT_KEY, height.min_height());
9090
}
9191

tiles/src/main/java/com/protomaps/basemap/layers/Earth.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.onthegomap.planetiler.VectorTile;
77
import com.onthegomap.planetiler.geo.GeometryException;
88
import com.onthegomap.planetiler.reader.SourceFeature;
9+
import com.protomaps.basemap.feature.FeatureId;
10+
import com.protomaps.basemap.names.OsmNames;
911
import java.util.List;
1012

1113
public class Earth implements ForwardingProfile.FeaturePostProcessor {
@@ -16,16 +18,29 @@ public String name() {
1618

1719
public void processPreparedOsm(SourceFeature ignoredSf, FeatureCollector features) {
1820
features.polygon(this.name())
19-
.setAttr("pmap:kind", "earth")
21+
.setAttr("kind", "earth")
2022
.setZoomRange(6, 15).setBufferPixels(8);
2123
}
2224

2325
public void processNe(SourceFeature sf, FeatureCollector features) {
2426
var sourceLayer = sf.getSourceLayer();
2527
if (sourceLayer.equals("ne_50m_land")) {
26-
features.polygon(this.name()).setZoomRange(0, 4).setBufferPixels(8).setAttr("pmap:kind", "earth");
28+
features.polygon(this.name()).setZoomRange(0, 4).setBufferPixels(8).setAttr("kind", "earth");
2729
} else if (sourceLayer.equals("ne_10m_land")) {
28-
features.polygon(this.name()).setZoomRange(5, 5).setBufferPixels(8).setAttr("pmap:kind", "earth");
30+
features.polygon(this.name()).setZoomRange(5, 5).setBufferPixels(8).setAttr("kind", "earth");
31+
}
32+
}
33+
34+
public void processOsm(SourceFeature sf, FeatureCollector features) {
35+
if (sf.canBeLine() && !sf.canBePolygon() && sf.hasTag("natural", "cliff")) {
36+
int minZoom = 12;
37+
var feat = features.line(this.name())
38+
.setId(FeatureId.create(sf))
39+
.setAttr("min_zoom", minZoom + 1)
40+
.setAttr("kind", "cliff")
41+
.setZoomRange(minZoom, 15);
42+
43+
OsmNames.setOsmNames(feat, sf, 0);
2944
}
3045
}
3146

tiles/src/main/java/com/protomaps/basemap/layers/Landcover.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void processLandcover(SourceFeature sf, FeatureCollector features) {
2626

2727
features.polygon(this.name())
2828
.setId(FeatureId.create(sf))
29-
.setAttr("pmap:kind", kind)
29+
.setAttr("kind", kind)
3030
.setZoomRange(0, 7)
3131
.setSortKey(sortKey)
3232
.setMinPixelSize(0.0);

tiles/src/main/java/com/protomaps/basemap/layers/Landuse.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
1818
sf.hasTag("amenity", "hospital", "school", "kindergarten", "university", "college") ||
1919
sf.hasTag("boundary", "national_park", "protected_area") ||
2020
sf.hasTag("landuse", "recreation_ground", "industrial", "brownfield", "railway", "cemetery", "commercial",
21-
"grass", "orchard", "farmland", "farmyard", "residential", "military", "village_green", "allotments") ||
21+
"grass", "orchard", "farmland", "farmyard", "residential", "military", "village_green", "allotments", "forest",
22+
"meadow", "grass") ||
2223
sf.hasTag("leisure", "park", "garden", "golf_course", "dog_park", "playground", "pitch", "nature_reserve") ||
2324
sf.hasTag("man_made", "pier", "bridge") ||
24-
sf.hasTag("natural", "beach") ||
25+
sf.hasTag("natural", "beach", "wood", "glacier", "grass", "scrub", "sand", "wetland", "bare_rock") ||
2526
// TODO: (nvkelso 20230622) This use of the place tag here is dubious, though paired with "residential"
2627
sf.hasTag("place", "neighbourhood") ||
2728
sf.hasTag("railway", "platform") ||
@@ -152,7 +153,7 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
152153
features.polygon(this.name())
153154
.setId(FeatureId.create(sf))
154155
// Core Tilezen schema properties
155-
.setAttr("pmap:kind", kind)
156+
.setAttr("kind", kind)
156157
// NOTE: (nvkelso 20230622) Consider zoom 5 instead...
157158
// But to match Protomaps v2 we do earlier
158159
.setZoomRange(2, 15)

tiles/src/main/java/com/protomaps/basemap/layers/Natural.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

tiles/src/main/java/com/protomaps/basemap/layers/PhysicalLine.java

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)