forked from protomaps/basemaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPois.java
592 lines (547 loc) · 25.7 KB
/
Pois.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
package com.protomaps.basemap.layers;
import static com.onthegomap.planetiler.util.Parse.parseDoubleOrNull;
import com.onthegomap.planetiler.FeatureCollector;
import com.onthegomap.planetiler.ForwardingProfile;
import com.onthegomap.planetiler.VectorTile;
import com.onthegomap.planetiler.geo.GeoUtils;
import com.onthegomap.planetiler.geo.GeometryException;
import com.onthegomap.planetiler.reader.SourceFeature;
import com.onthegomap.planetiler.util.ZoomFunction;
import com.protomaps.basemap.feature.FeatureId;
import com.protomaps.basemap.feature.QrankDb;
import com.protomaps.basemap.names.OsmNames;
import java.util.List;
public class Pois implements ForwardingProfile.FeatureProcessor, ForwardingProfile.FeaturePostProcessor {
private QrankDb qrankDb;
public Pois(QrankDb qrankDb) {
this.qrankDb = qrankDb;
}
@Override
public String name() {
return "pois";
}
private static final double WORLD_AREA_FOR_70K_SQUARE_METERS =
Math.pow(GeoUtils.metersToPixelAtEquator(0, Math.sqrt(70_000)) / 256d, 2);
private static final double LOG2 = Math.log(2);
@Override
public void processFeature(SourceFeature sf, FeatureCollector features) {
if ((sf.isPoint() || sf.canBePolygon()) && (sf.hasTag("aeroway", "aerodrome") ||
sf.hasTag("amenity") ||
sf.hasTag("attraction") ||
sf.hasTag("boundary", "national_park", "protected_area") ||
sf.hasTag("craft") ||
sf.hasTag("historic") ||
sf.hasTag("landuse", "cemetery", "recreation_ground", "winter_sports", "quarry", "park", "forest", "military",
"village_green", "allotments") ||
sf.hasTag("leisure") ||
sf.hasTag("natural", "beach") ||
sf.hasTag("railway", "station") ||
sf.hasTag("highway", "bus_stop") ||
sf.hasTag("shop") ||
sf.hasTag("tourism") &&
(!sf.hasTag("historic", "district")))) {
String kind = "other";
String kindDetail = "";
Integer minZoom = 15;
String wikidata = sf.getString("wikidata");
if (wikidata != null) {
qrankDb.get(wikidata);
}
if (sf.hasTag("aeroway", "aerodrome")) {
kind = sf.getString("aeroway");
minZoom = 13;
// Emphasize large international airports earlier
if (kind.equals("aerodrome") && sf.hasTag("iata")) {
minZoom -= 2;
}
if (sf.hasTag("aerodrome")) {
kindDetail = sf.getString("aerodrome");
}
} else if (sf.hasTag("amenity", "university", "college")) {
kind = sf.getString("amenity");
// One would think University should be earlier, but there are lots of dinky node only places
// So if the university has a large area, it'll naturally improve it's zoom in the next section...
minZoom = 14;
} else if (sf.hasTag("amenity", "hospital")) {
kind = sf.getString("amenity");
minZoom = 12;
} else if (sf.hasTag("amenity", "library", "post_office", "townhall")) {
kind = sf.getString("amenity");
minZoom = 13;
} else if (sf.hasTag("amenity", "school")) {
kind = sf.getString("amenity");
minZoom = 15;
} else if (sf.hasTag("amenity", "cafe")) {
kind = sf.getString("amenity");
minZoom = 15;
} else if (sf.hasTag("landuse", "cemetery")) {
kind = sf.getString("landuse");
minZoom = 14;
} else if (sf.hasTag("landuse", "military")) {
kind = "military";
if (sf.hasTag("military", "naval_base", "airfield")) {
kind = sf.getString("military");
}
} else if (sf.hasTag("leisure", "park")) {
kind = "park";
// Lots of pocket parks and NODE parks, show those later than rest of leisure
minZoom = 14;
} else if (sf.hasTag("leisure", "golf_course", "marina", "stadium")) {
kind = sf.getString("leisure");
minZoom = 13;
} else if (sf.hasTag("shop", "grocery", "supermarket")) {
kind = sf.getString("shop");
minZoom = 14;
} else if (sf.hasTag("tourism", "attraction", "camp_site", "hotel")) {
kind = sf.getString("tourism");
minZoom = 15;
} else if (sf.hasTag("highway", "bus_stop")) {
kind = sf.getString("highway");
minZoom = 17;
} else {
// Avoid problem of too many "other" kinds
// All these will default to min_zoom of 15
// If a more specific min_zoom is needed (or sanitize kind values)
// then add new logic in section above
if (sf.hasTag("amenity")) {
kind = sf.getString("amenity");
} else if (sf.hasTag("attraction")) {
kind = sf.getString("attraction");
} else if (sf.hasTag("craft")) {
kind = sf.getString("craft");
} else if (sf.hasTag("aeroway")) {
kind = sf.getString("aeroway");
} else if (sf.hasTag("landuse")) {
kind = sf.getString("landuse");
} else if (sf.hasTag("leisure")) {
kind = sf.getString("leisure");
} else if (sf.hasTag("natural")) {
kind = sf.getString("natural");
} else if (sf.hasTag("railway")) {
kind = sf.getString("railway");
} else if (sf.hasTag("highway")) {
kind = sf.getString("highway");
} else if (sf.hasTag("shop")) {
kind = sf.getString("shop");
} else if (sf.hasTag("tourism")) {
kind = sf.getString("tourism");
// Boundary is most generic, so place last else we loose out
// on nature_reserve detail versus all the protected_area
} else if (sf.hasTag("historic") && !sf.hasTag("historic", "yes")) {
kind = sf.getString("historic");
} else if (sf.hasTag("boundary")) {
kind = sf.getString("boundary");
}
}
// National forests
if (sf.hasTag("boundary", "national_park") &&
sf.hasTag("operator", "United States Forest Service", "US Forest Service", "U.S. Forest Service",
"USDA Forest Service", "United States Department of Agriculture", "US National Forest Service",
"United State Forest Service", "U.S. National Forest Service")) {
kind = "forest";
} else if (sf.hasTag("boundary", "national_park") &&
sf.hasTag("protect_class", "6") &&
sf.hasTag("protection_title", "National Forest")) {
kind = "forest";
} else if (sf.hasTag("landuse", "forest") &&
sf.hasTag("protect_class", "6")) {
kind = "forest";
} else if (sf.hasTag("landuse", "forest") &&
sf.hasTag("operator", "United States Forest Service", "US Forest Service", "U.S. Forest Service",
"USDA Forest Service", "United States Department of Agriculture", "US National Forest Service",
"United State Forest Service", "U.S. National Forest Service")) {
kind = "forest";
} else if (sf.hasTag("landuse", "forest")) {
kind = "forest";
} else if (sf.hasTag("boundary", "protected_area") &&
sf.hasTag("protect_class", "6") &&
sf.hasTag("operator", "United States Forest Service", "US Forest Service", "U.S. Forest Service",
"USDA Forest Service", "United States Department of Agriculture", "US National Forest Service",
"United State Forest Service", "U.S. National Forest Service")) {
kind = "forest";
}
// National parks
if (sf.hasTag("boundary", "national_park")) {
if (!(sf.hasTag("operator", "United States Forest Service", "US Forest Service", "U.S. Forest Service",
"USDA Forest Service", "United States Department of Agriculture", "US National Forest Service",
"United State Forest Service", "U.S. National Forest Service") ||
sf.hasTag("protection_title", "Conservation Area", "Conservation Park", "Environmental use", "Forest Reserve",
"National Forest", "National Wildlife Refuge", "Nature Refuge", "Nature Reserve", "Protected Site",
"Provincial Park", "Public Access Land", "Regional Reserve", "Resources Reserve", "State Forest",
"State Game Land", "State Park", "Watershed Recreation Unit", "Wild Forest", "Wilderness Area",
"Wilderness Study Area", "Wildlife Management", "Wildlife Management Area", "Wildlife Sanctuary")) &&
(sf.hasTag("protect_class", "2", "3") ||
sf.hasTag("operator", "United States National Park Service", "National Park Service",
"US National Park Service", "U.S. National Park Service", "US National Park service") ||
sf.hasTag("operator:en", "Parks Canada") ||
sf.hasTag("designation", "national_park") ||
sf.hasTag("protection_title", "National Park"))) {
kind = "national_park";
minZoom = 11;
} else {
kind = "park";
}
}
if (sf.hasTag("cuisine")) {
kindDetail = sf.getString("cuisine");
} else if (sf.hasTag("religion")) {
kindDetail = sf.getString("religion");
} else if (sf.hasTag("sport")) {
kindDetail = sf.getString("sport");
}
// try first for polygon -> point representations
if (sf.canBePolygon() && sf.hasTag("name") && sf.getString("name") != null) {
Double wayArea = 0.0;
try {
wayArea = sf.worldGeometry().getEnvelopeInternal().getArea() / WORLD_AREA_FOR_70K_SQUARE_METERS;
} catch (GeometryException e) {
e.log("Exception in POI way calculation");
}
double height = 0.0;
if (sf.hasTag("height")) {
Double parsed = parseDoubleOrNull(sf.getString("height"));
if (parsed != null) {
height = parsed;
}
}
// Area zoom grading overrides the kind zoom grading in the section above.
// Roughly shared with the water label area zoom grading in physical points layer
//
// Allowlist of kind values eligible for early zoom point labels
if (kind.equals("national_park")) {
if (wayArea > 300000) { // 500000000 sq meters (web mercator proj)
minZoom = 5;
} else if (wayArea > 25000) { // 500000000 sq meters (web mercator proj)
minZoom = 6;
} else if (wayArea > 10000) { // 500000000
minZoom = 7;
} else if (wayArea > 2000) { // 200000000
minZoom = 8;
} else if (wayArea > 250) { // 40000000
minZoom = 9;
} else if (wayArea > 100) { // 8000000
minZoom = 10;
} else if (wayArea > 20) { // 500000
minZoom = 11;
} else if (wayArea > 5) {
minZoom = 12;
} else if (wayArea > 1) {
minZoom = 13;
} else if (wayArea > 0.25) {
minZoom = 14;
}
} else if (kind.equals("aerodrome") ||
kind.equals("golf_course") ||
kind.equals("military") ||
kind.equals("naval_base") ||
kind.equals("stadium") ||
kind.equals("zoo")) {
//if (way_area > 300000) { // 500000000 sq meters (web mercator proj)
// min_zoom = 5;
//} else if (way_area > 25000) { // 500000000 sq meters (web mercator proj)
// min_zoom = 6;
//} else
if (wayArea > 20000) { // 500000000
minZoom = 7;
} else if (wayArea > 5000) { // 200000000
minZoom = 8;
} else if (wayArea > 250) { // 40000000
minZoom = 9;
} else if (wayArea > 100) { // 8000000
minZoom = 10;
} else if (wayArea > 20) { // 500000
minZoom = 11;
} else if (wayArea > 5) {
minZoom = 12;
} else if (wayArea > 1) {
minZoom = 13;
} else if (wayArea > 0.25) {
minZoom = 14;
}
// Emphasize large international airports earlier
// Because the area grading resets the earlier dispensation
if (kind.equals("aerodrome")) {
if (sf.hasTag("iata")) {
// prioritize international airports over regional airports
minZoom -= 2;
// but don't show international airports tooooo early
if (minZoom < 10) {
minZoom = 10;
}
} else {
// and show other airports only once their polygon begins to be visible
if (minZoom < 12) {
minZoom = 12;
}
}
}
} else if (kind.equals("college") ||
kind.equals("university")) {
if (wayArea > 20000) {
minZoom = 7;
} else if (wayArea > 5000) {
minZoom = 8;
} else if (wayArea > 250) {
minZoom = 9;
} else if (wayArea > 150) {
minZoom = 10;
} else if (wayArea > 100) {
minZoom = 11;
} else if (wayArea > 50) {
minZoom = 12;
} else if (wayArea > 20) {
minZoom = 13;
} else if (wayArea > 5) {
minZoom = 14;
} else {
minZoom = 15;
}
// Hack for weird San Francisco university
if (sf.getString("name").equals("Academy of Art University")) {
minZoom = 14;
}
} else if (kind.equals("forest") ||
kind.equals("park") ||
kind.equals("protected_area") ||
kind.equals("nature_reserve") ||
kind.equals("village_green")) {
if (wayArea > 10000) {
minZoom = 7;
} else if (wayArea > 4000) {
minZoom = 8;
} else if (wayArea > 1000) {
minZoom = 9;
} else if (wayArea > 250) {
minZoom = 10;
} else if (wayArea > 15) {
minZoom = 11;
} else if (wayArea > 5) {
minZoom = 12;
} else if (wayArea > 1) {
minZoom = 13;
} else if (wayArea > 0.25) {
minZoom = 14;
} else if (wayArea > 0.01) {
minZoom = 15;
} else if (wayArea > 0.001) {
minZoom = 16;
} else {
minZoom = 17;
}
// Discount wilderness areas within US national forests and parks
if (kind.equals("nature_reserve")) {
if (sf.getString("name").contains("Wilderness")) {
minZoom = minZoom + 1;
}
}
} else if (kind.equals("cemetery") ||
kind.equals("school")) {
if (wayArea > 5) {
minZoom = 12;
} else if (wayArea > 1) {
minZoom = 13;
} else if (wayArea > 0.1) {
minZoom = 14;
} else if (wayArea > 0.01) {
minZoom = 15;
} else {
minZoom = 16;
}
// Typically for "building" derived label placements for shops and other businesses
} else if (kind.equals("allotments")) {
if (wayArea > 0.01) {
minZoom = 15;
} else {
minZoom = 16;
}
} else if (kind.equals("playground")) {
minZoom = 17;
} else {
if (wayArea > 10) {
minZoom = 11;
} else if (wayArea > 2) {
minZoom = 12;
} else if (wayArea > 0.5) {
minZoom = 13;
} else if (wayArea > 0.01) {
minZoom = 14;
}
// Small but tall features should show up early as they have regional prominance.
// Height measured in meters
if (minZoom >= 13 && height > 0.0) {
if (height >= 100) {
minZoom = 11;
} else if (height >= 20) {
minZoom = 12;
} else if (height >= 10) {
minZoom = 13;
}
// Clamp certain kind values so medium tall buildings don't crowd downtown areas
// NOTE: (nvkelso 20230623) Apply label grid to early zooms of POIs layer
// NOTE: (nvkelso 20230624) Turn this into an allowlist instead of a blocklist
if (kind.equals("hotel") || kind.equals("hostel") || kind.equals("parking") || kind.equals("bank") ||
kind.equals("place_of_worship") || kind.equals("jewelry") || kind.equals("yes") ||
kind.equals("restaurant") || kind.equals("coworking_space") || kind.equals("clothes") ||
kind.equals("art") || kind.equals("school")) {
if (minZoom == 12) {
minZoom = 13;
}
}
// Discount tall self storage buildings
if (kind.equals("storage_rental")) {
minZoom = 14;
}
// Discount tall university buildings, require a related university landuse AOI
if (kind.equals("university")) {
minZoom = 13;
}
}
}
// very long text names should only be shown at later zooms
if (minZoom < 14) {
var nameLength = sf.getString("name").length();
if (nameLength > 30) {
if (nameLength > 45) {
minZoom += 2;
} else {
minZoom += 1;
}
}
}
var polyLabelPosition = features.pointOnSurface(this.name())
// all POIs should receive their IDs at all zooms
// (there is no merging of POIs like with lines and polygons in other layers)
.setId(FeatureId.create(sf))
// Core Tilezen schema properties
.setAttr("pmap:kind", kind)
// While other layers don't need min_zoom, POIs do for more predictable client-side label collisions
// 512 px zooms versus 256 px logical zooms
.setAttr("pmap:min_zoom", minZoom + 1)
//
// DEBUG
//.setAttr("pmap:area_debug", wayArea)
//
// Core OSM tags for different kinds of places
// Special airport only tag (to indicate if it's an airport with regular commercial flights)
.setAttr("iata", sf.getString("iata"))
// DEPRECATION WARNING: Marked for deprecation in v4 schema, do not use these for styling
// If an explicate value is needed it should be a kind, or included in kind_detail
.setAttr("amenity", sf.getString("amenity"))
.setAttr("attraction", sf.getString("attraction"))
.setAttr("craft", sf.getString("craft"))
.setAttr("historic", sf.getString("historic"))
.setAttr("landuse", sf.getString("landuse"))
.setAttr("leisure", sf.getString("leisure"))
.setAttr("natural", sf.getString("natural"))
.setAttr("railway", sf.getString("railway"))
.setAttr("shop", sf.getString("shop"))
.setAttr("tourism", sf.getString("tourism"))
// Extra OSM tags for certain kinds of places
// These are duplicate of what's in the kind_detail tag
// DEPRECATION WARNING: Marked for deprecation in v4 schema, do not use these for styling
// If an explicate value is needed it should be a kind, or included in kind_detail
.setAttr("cuisine", sf.getString("cuisine"))
.setAttr("religion", sf.getString("religion"))
.setAttr("sport", sf.getString("sport"))
.setZoomRange(Math.min(15, minZoom), 15)
.setBufferPixels(128);
// Core Tilezen schema properties
if (!kindDetail.isEmpty()) {
polyLabelPosition.setAttr("pmap:kind_detail", kindDetail);
}
OsmNames.setOsmNames(polyLabelPosition, sf, 0);
// Server sort features so client label collisions are pre-sorted
// NOTE: (nvkelso 20230627) This could also include other params like the name
polyLabelPosition.setSortKey(minZoom * 1000);
// Even with the categorical zoom bucketing above, we end up with too dense a point feature spread in downtown
// areas, so cull the labels which wouldn't label at earlier zooms than the max_zoom of 15
polyLabelPosition.setPointLabelGridSizeAndLimit(14, 10, 1);
// and also whenever you set a label grid size limit, make sure you increase the buffer size so no
// label grid squares will be the consistent between adjacent tiles
polyLabelPosition.setBufferPixelOverrides(ZoomFunction.maxZoom(14, 32));
} else if (sf.isPoint()) {
var pointFeature = features.point(this.name())
// all POIs should receive their IDs at all zooms
// (there is no merging of POIs like with lines and polygons in other layers)
.setId(FeatureId.create(sf))
// Core Tilezen schema properties
.setAttr("pmap:kind", kind)
// While other layers don't need min_zoom, POIs do for more predictable client-side label collisions
// 512 px zooms versus 256 px logical zooms
.setAttr("pmap:min_zoom", minZoom + 1)
// Core OSM tags for different kinds of places
// Special airport only tag (to indicate if it's an airport with regular commercial flights)
.setAttr("iata", sf.getString("iata"))
// DEPRECATION WARNING: Marked for deprecation in v4 schema, do not use these for styling
// If an explicate value is needed it should bea kind, or included in kind_detail
.setAttr("amenity", sf.getString("amenity"))
.setAttr("attraction", sf.getString("attraction"))
.setAttr("craft", sf.getString("craft"))
.setAttr("historic", sf.getString("historic"))
.setAttr("landuse", sf.getString("landuse"))
.setAttr("leisure", sf.getString("leisure"))
.setAttr("natural", sf.getString("natural"))
.setAttr("railway", sf.getString("railway"))
.setAttr("shop", sf.getString("shop"))
.setAttr("tourism", sf.getString("tourism"))
// Extra OSM tags for certain kinds of places
// These are duplicate of what's in the kind_detail tag
// DEPRECATION WARNING: Marked for deprecation in v4 schema, do not use these for styling
// If an explicate value is needed it should bea kind, or included in kind_detail
.setAttr("cuisine", sf.getString("cuisine"))
.setAttr("religion", sf.getString("religion"))
.setAttr("sport", sf.getString("sport"))
.setZoomRange(Math.min(minZoom, 15), 15)
.setBufferPixels(128);
// Core Tilezen schema properties
if (!kindDetail.isEmpty()) {
pointFeature.setAttr("pmap:kind_detail", kindDetail);
}
OsmNames.setOsmNames(pointFeature, sf, 0);
// Some features should only be visible at very late zooms when they don't have a name
if (!sf.hasTag("name") && (sf.hasTag("amenity", "atm", "bbq", "bench", "bicycle_parking",
"bicycle_rental", "bicycle_repair_station", "boat_storage", "bureau_de_change", "car_rental", "car_sharing",
"car_wash", "charging_station", "customs", "drinking_water", "fuel", "harbourmaster", "hunting_stand",
"karaoke_box", "life_ring", "money_transfer", "motorcycle_parking", "parking", "picnic_table", "post_box",
"ranger_station", "recycling", "sanitary_dump_station", "shelter", "shower", "taxi", "telephone", "toilets",
"waste_basket", "waste_disposal", "water_point", "watering_place", "bicycle_rental", "motorcycle_parking",
"charging_station") ||
sf.hasTag("historic", "landmark", "wayside_cross") ||
sf.hasTag("leisure", "dog_park", "firepit", "fishing", "pitch", "playground", "slipway", "swimming_area") ||
sf.hasTag("tourism", "alpine_hut", "information", "picnic_site", "viewpoint", "wilderness_hut"))) {
pointFeature.setAttr("pmap:min_zoom", 17);
}
if (sf.hasTag("amenity", "clinic", "dentist", "doctors", "social_facility", "baby_hatch", "childcare",
"car_sharing", "bureau_de_change", "emergency_phone", "karaoke", "karaoke_box", "money_transfer", "car_wash",
"hunting_stand", "studio", "boat_storage", "gambling", "adult_gaming_centre", "sanitary_dump_station",
"attraction", "animal", "water_slide", "roller_coaster", "summer_toboggan", "carousel", "amusement_ride",
"maze") ||
sf.hasTag("historic", "memorial", "district") ||
sf.hasTag("leisure", "pitch", "playground", "slipway") ||
sf.hasTag("shop", "scuba_diving", "atv", "motorcycle", "snowmobile", "art", "bakery", "beauty", "bookmaker",
"books", "butcher", "car", "car_parts", "car_repair", "clothes", "computer", "convenience", "fashion",
"florist", "garden_centre", "gift", "golf", "greengrocer", "grocery", "hairdresser", "hifi", "jewelry",
"lottery", "mobile_phone", "newsagent", "optician", "perfumery", "ship_chandler", "stationery", "tobacco",
"travel_agency") ||
sf.hasTag("tourism", "artwork", "hanami", "trail_riding_station", "bed_and_breakfast", "chalet",
"guest_house", "hostel")) {
pointFeature.setAttr("pmap:min_zoom", 17);
}
// Server sort features so client label collisions are pre-sorted
// NOTE: (nvkelso 20230627) This could also include other params like the name
pointFeature.setSortKey(minZoom * 1000);
// Even with the categorical zoom bucketing above, we end up with too dense a point feature spread in downtown
// areas, so cull the labels which wouldn't label at earlier zooms than the max_zoom of 15
pointFeature.setPointLabelGridSizeAndLimit(14, 10, 1);
// and also whenever you set a label grid size limit, make sure you increase the buffer size so no
// label grid squares will be the consistent between adjacent tiles
pointFeature.setBufferPixelOverrides(ZoomFunction.maxZoom(14, 32));
}
}
}
@Override
public List<VectorTile.Feature> postProcess(int zoom, List<VectorTile.Feature> items) throws GeometryException {
// TODO: (nvkelso 20230623) Consider adding a "pmap:rank" here for POIs, like for Places
return items;
}
}