forked from protomaps/basemaps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoisTest.java
More file actions
1447 lines (1326 loc) · 39.9 KB
/
Copy pathPoisTest.java
File metadata and controls
1447 lines (1326 loc) · 39.9 KB
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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package com.protomaps.basemap.layers;
import static com.onthegomap.planetiler.TestUtils.*;
import static org.junit.jupiter.api.Assertions.assertFalse;
import com.onthegomap.planetiler.reader.SimpleFeature;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.locationtech.jts.geom.Geometry;
class PoisTest extends LayerTest {
// Static polygon instances testing area thresholds in Pois.java
private static final Geometry AREA_2K_SQ_KM = newPolygon(0, 0, 0, 0.4, 0.4, 0.4, 0.4, 0, 0, 0);
private static final Geometry AREA_1K_SQ_KM = newPolygon(0, 0, 0, 0.3, 0.3, 0.3, 0.3, 0, 0, 0);
private static final Geometry AREA_8_SQ_KM = newPolygon(0, 0, 0, 0.025, 0.025, 0.025, 0.025, 0, 0, 0);
private static final Geometry AREA_5_SQ_KM = newPolygon(0, 0, 0, 0.020, 0.020, 0.020, 0.020, 0, 0, 0);
private static final Geometry AREA_3_SQ_KM = newPolygon(0, 0, 0, 0.015, 0.015, 0.015, 0.015, 0, 0, 0);
private static final Geometry AREA_12K_SQ_M = newPolygon(0, 0, 0, 0.001, 0.001, 0.001, 0.001, 0, 0, 0);
private static final Geometry AREA_127_SQ_M = newPolygon(0, 0, 0, 0.0001, 0.0001, 0.0001, 0.0001, 0, 0, 0);
@Test
void simple() {
assertFeatures(12,
List.of(Map.of("kind", "school")),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "school")),
"osm",
null,
0
)));
}
@Test
void busStop() {
assertFeatures(15,
List.of(Map.of("kind", "bus_stop", "min_zoom", 18)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("highway", "bus_stop")),
"osm",
null,
0
)));
}
@Test
void allotments() {
// this test shows two list elements because we're running against the whole profile, which means we're getting
// results form multiple layer classes. This may mean the test breaks when other layer classes are changed.
assertFeatures(15,
List.of(Map.of("kind", "allotments"),
Map.of("kind", "allotments", "min_zoom", 16, "name", "Kleingartenverein Kartoffel")),
process(SimpleFeature.create(
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
new HashMap<>(Map.of("landuse", "allotments", "name", "Kleingartenverein Kartoffel")),
"osm",
null,
0
)));
}
@Test
void villageGreen() {
assertFeatures(15,
List.of(Map.of("kind", "village_green"),
Map.of("kind", "village_green", "min_zoom", 8, "name", "Stadtpark Eiche")),
process(SimpleFeature.create(
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
new HashMap<>(Map.of("landuse", "village_green", "name", "Stadtpark Eiche")),
"osm",
null,
0
)));
}
@Test
void playground() {
assertFeatures(15,
List.of(Map.of("kind", "playground"),
Map.of("kind", "playground", "min_zoom", 18, "name", "Spielwiese")),
process(SimpleFeature.create(
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
new HashMap<>(Map.of("leisure", "playground", "name", "Spielwiese")),
"osm",
null,
0
)));
}
@Test
void withQrank() {
assertFeatures(11,
List.of(
Map.of("kind", "aerodrome", "name", "SFO", "min_zoom", 11)),
process(SimpleFeature.create(
newPoint(0, 0),
new HashMap<>(Map.of("aeroway", "aerodrome", "name", "SFO", "wikidata", "Q8888")),
"osm",
null,
0
)));
}
@Test
void withQrankPoly() {
assertFeatures(11,
List.of(Map.of("kind", "aerodrome"),
Map.of("kind", "aerodrome", "name", "SFO", "min_zoom", 11)),
process(SimpleFeature.create(
newPolygon(0, 0, 0, 1, 1, 1, 1, 0, 0, 0),
new HashMap<>(Map.of("aeroway", "aerodrome", "name", "SFO", "wikidata", "Q8888")),
"osm",
null,
0
)));
}
// ========== Representative MinZoom tests ==========
@Test
void zoom_14_aerodrome_default() {
assertFeatures(14,
List.of(Map.of("kind", "aerodrome", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("aeroway", "aerodrome")),
"osm", null, 0
)));
}
@Test
void zoom_12_aerodrome_withIATA() {
assertFeatures(12,
List.of(Map.of("kind", "aerodrome", "min_zoom", 12)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("aeroway", "aerodrome", "iata", "LAX")),
"osm", null, 0
)));
}
@Test
void zoom_13_hospital() {
assertFeatures(13,
List.of(Map.of("kind", "hospital", "min_zoom", 13)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "hospital")),
"osm", null, 0
)));
}
@Test
void zoom_14_library() {
assertFeatures(14,
List.of(Map.of("kind", "library", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "library")),
"osm", null, 0
)));
}
@Test
void zoom_15_university() {
assertFeatures(15,
List.of(Map.of("kind", "university", "min_zoom", 15)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "university")),
"osm", null, 0
)));
}
@Test
void zoom_16_cafe() {
assertFeatures(15,
List.of(Map.of("kind", "cafe", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "cafe")),
"osm", null, 0
)));
}
@Test
void zoom_14_peak() {
assertFeatures(14,
List.of(Map.of("kind", "peak", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("natural", "peak")),
"osm", null, 0
)));
}
@Test
void peakElevation() {
assertFeatures(14,
List.of(Map.of("kind", "peak", "min_zoom", 14, "elevation", 569)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("natural", "peak", "ele", "569")),
"osm", null, 0
)));
}
@Test
void peakElevationDecimal() {
assertFeatures(14,
List.of(Map.of("kind", "peak", "min_zoom", 14, "elevation", 570)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("natural", "peak", "ele", "569.5")),
"osm", null, 0
)));
}
@Test
void peakElevationMeterSuffix() {
assertFeatures(14,
List.of(Map.of("kind", "peak", "min_zoom", 14, "elevation", 569)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("natural", "peak", "ele", "569 m")),
"osm", null, 0
)));
}
@Test
void peakElevationMeterSuffixWithoutWhitespace() {
assertFeatures(14,
List.of(Map.of("kind", "peak", "min_zoom", 14, "elevation", 569)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("natural", "peak", "ele", "569m")),
"osm", null, 0
)));
}
@Test
void peakElevationNonMeterUnitOmitted() {
var features = process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("natural", "peak", "ele", "569 ft")),
"osm", null, 0
));
assertFalse(toMap(features.iterator().next(), 14).containsKey("elevation"));
}
@Test
void zoom_14_golfCourse() {
assertFeatures(14,
List.of(Map.of("kind", "golf_course", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "golf_course")),
"osm", null, 0
)));
}
@Test
void zoom_15_supermarket() {
assertFeatures(15,
List.of(Map.of("kind", "supermarket", "min_zoom", 15)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("shop", "supermarket")),
"osm", null, 0
)));
}
@Test
void zoom_16_attraction() {
assertFeatures(15,
List.of(Map.of("kind", "attraction", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("tourism", "attraction")),
"osm", null, 0
)));
}
@Test
void zoom_15_parkPoint() {
assertFeatures(15,
List.of(Map.of("kind", "park", "min_zoom", 15)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "park")),
"osm", null, 0
)));
}
@Test
void zoom_15_cemetery() {
assertFeatures(15,
List.of(Map.of("kind", "cemetery", "min_zoom", 15)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("landuse", "cemetery")),
"osm", null, 0
)));
}
@Test
void zoom_14_stadium() {
assertFeatures(14,
List.of(Map.of("kind", "stadium", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "stadium")),
"osm", null, 0
)));
}
@Test
void zoom_14_marina() {
assertFeatures(14,
List.of(Map.of("kind", "marina", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "marina")),
"osm", null, 0
)));
}
@Test
void zoom_16_campSite() {
assertFeatures(15,
List.of(Map.of("kind", "camp_site", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("tourism", "camp_site")),
"osm", null, 0
)));
}
@Test
void zoom_16_hotel() {
assertFeatures(15,
List.of(Map.of("kind", "hotel", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("tourism", "hotel")),
"osm", null, 0
)));
}
@Test
void zoom_14_postOffice() {
assertFeatures(14,
List.of(Map.of("kind", "post_office", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "post_office")),
"osm", null, 0
)));
}
@Test
void zoom_14_townhall() {
assertFeatures(14,
List.of(Map.of("kind", "townhall", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "townhall")),
"osm", null, 0
)));
}
@Test
void zoom_15_college() {
assertFeatures(15,
List.of(Map.of("kind", "college", "min_zoom", 15)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "college")),
"osm", null, 0
)));
}
@Test
void zoom_17_grocery_unnamed() {
assertFeatures(15,
List.of(Map.of("kind", "grocery", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("shop", "grocery")),
"osm", null, 0
)));
}
// ========== Special cases and overrides ==========
@Test
void zoom_7_nationalPark_default() {
assertFeatures(7,
List.of(Map.of("kind", "national_park"),
Map.of("kind", "national_park", "min_zoom", 7, "name", "Yosemite")),
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "national_park",
"name", "Yosemite",
"protect_class", "2"
)),
"osm", null, 0
)));
}
@Test
void zoom_8_nationalForest_usfsOperator() {
assertFeatures(8,
List.of(Map.of("kind", "park"), // landuse layer
Map.of("kind", "park", "min_zoom", 8, "name", "Angeles National Forest")), // pois layer shows as park with area-based zoom
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "national_park",
"name", "Angeles National Forest",
"operator", "United States Forest Service"
)),
"osm", null, 0
)));
}
@Test
void zoom_16_navalBase() {
assertFeatures(15,
List.of(Map.of("kind", "naval_base", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("landuse", "military", "military", "naval_base")),
"osm", null, 0
)));
}
@Test
void zoom_16_airfield() {
assertFeatures(15,
List.of(Map.of("kind", "airfield", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("landuse", "military", "military", "airfield")),
"osm", null, 0
)));
}
@Test
void zoom_16_kindDetail_cuisine() {
assertFeatures(15,
List.of(Map.of("kind", "cafe", "kind_detail", "italian", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "cafe", "cuisine", "italian")),
"osm", null, 0
)));
}
@Test
void zoom_16_kindDetail_religion() {
assertFeatures(15,
List.of(Map.of("kind", "place_of_worship", "kind_detail", "christian", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "place_of_worship", "religion", "christian")),
"osm", null, 0
)));
}
@Test
void zoom_14_kindDetail_sport() {
assertFeatures(15,
List.of(Map.of("kind", "stadium", "kind_detail", "soccer", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "stadium", "sport", "soccer")),
"osm", null, 0
)));
}
@Test
void zoom_14_aerodromeDetail() {
assertFeatures(15,
List.of(Map.of("kind", "aerodrome", "kind_detail", "international", "min_zoom", 14)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("aeroway", "aerodrome", "aerodrome", "international")),
"osm", null, 0
)));
}
// ========== Area-based zoom overrides ==========
@Test
void zoom_7_nationalPark_largeArea() {
assertFeatures(7,
List.of(Map.of("kind", "national_park"),
Map.of("kind", "national_park", "min_zoom", 7, "name", "Huge Park")),
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "national_park",
"name", "Huge Park",
"protect_class", "2"
)),
"osm", null, 0
)));
}
@Test
void zoom_13_aerodrome_largePolygon() {
assertFeatures(13,
List.of(Map.of("kind", "aerodrome"),
Map.of("kind", "aerodrome", "min_zoom", 13, "name", "Big Airport")),
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"aeroway", "aerodrome",
"name", "Big Airport"
)),
"osm", null, 0
)));
}
@Test
void zoom_11_aerodrome_polygonWithIATA() {
assertFeatures(11,
List.of(Map.of("kind", "aerodrome"),
Map.of("kind", "aerodrome", "min_zoom", 11, "name", "JFK", "iata", "JFK")),
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"aeroway", "aerodrome",
"name", "JFK",
"iata", "JFK"
)),
"osm", null, 0
)));
}
@Test
void zoom_13_aerodrome_smallPolygonNoIATA() {
assertFeatures(13,
List.of(Map.of("kind", "aerodrome"),
Map.of("kind", "aerodrome", "min_zoom", 13, "name", "Regional Airport")),
process(SimpleFeature.create(
AREA_5_SQ_KM,
new HashMap<>(Map.of(
"aeroway", "aerodrome",
"name", "Regional Airport"
)),
"osm", null, 0
)));
}
@Test
void zoom_8_university_largeArea() {
assertFeatures(8,
List.of(Map.of("kind", "university"),
Map.of("kind", "university", "min_zoom", 8, "name", "Large State University")),
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"amenity", "university",
"name", "Large State University"
)),
"osm", null, 0
)));
}
@Test
void zoom_15_university_academyOfArt() {
assertFeatures(15,
List.of(Map.of("kind", "university"),
Map.of("kind", "university", "min_zoom", 15, "name", "Academy of Art University")),
process(SimpleFeature.create(
AREA_2K_SQ_KM,
new HashMap<>(Map.of(
"amenity", "university",
"name", "Academy of Art University"
)),
"osm", null, 0
)));
}
@Test
void zoom_8_park_largeArea() {
assertFeatures(8,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 8, "name", "Giant City Park")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"leisure", "park",
"name", "Giant City Park"
)),
"osm", null, 0
)));
}
@Test
void zoom_12_park_mediumArea() {
assertFeatures(12,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 12, "name", "Medium Park")),
process(SimpleFeature.create(
AREA_3_SQ_KM,
new HashMap<>(Map.of(
"leisure", "park",
"name", "Medium Park"
)),
"osm", null, 0
)));
}
@Test
void zoom_13_cemetery_largeArea() {
assertFeatures(13,
List.of(Map.of("kind", "cemetery"),
Map.of("kind", "cemetery", "min_zoom", 13, "name", "Large Cemetery")),
process(SimpleFeature.create(
AREA_8_SQ_KM,
new HashMap<>(Map.of(
"landuse", "cemetery",
"name", "Large Cemetery"
)),
"osm", null, 0
)));
}
@Test
void zoom_13_school_largeArea() {
assertFeatures(13,
List.of(Map.of("kind", "school"),
Map.of("kind", "school", "min_zoom", 13, "name", "Large School")),
process(SimpleFeature.create(
AREA_8_SQ_KM,
new HashMap<>(Map.of(
"amenity", "school",
"name", "Large School"
)),
"osm", null, 0
)));
}
@Test
void zoom_13_natureReserve_wilderness() {
assertFeatures(13,
List.of(Map.of("kind", "nature_reserve"),
Map.of("kind", "nature_reserve", "min_zoom", 13, "name", "Some Wilderness")),
process(SimpleFeature.create(
AREA_3_SQ_KM,
new HashMap<>(Map.of(
"leisure", "nature_reserve",
"name", "Some Wilderness"
)),
"osm", null, 0
)));
}
@Test
void zoom_8_forest_largeArea() {
assertFeatures(8,
List.of(Map.of("kind", "forest"),
Map.of("kind", "forest", "min_zoom", 8, "name", "Big Forest")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"landuse", "forest",
"name", "Big Forest"
)),
"osm", null, 0
)));
}
// ========== Height-based zoom boost ==========
@Test
void zoom_12_tallBuilding_100mHeight() {
assertFeatures(12,
List.of(Map.of("kind", "office", "min_zoom", 12, "name", "Skyscraper", "elevation", 100)),
process(SimpleFeature.create(
AREA_12K_SQ_M,
new HashMap<>(Map.of(
"amenity", "office",
"name", "Skyscraper",
"height", "100",
"ele", "100"
)),
"osm", null, 0
)));
}
@Test
void zoom_14_tallHotel_clamped() {
assertFeatures(14,
List.of(Map.of("kind", "hotel", "min_zoom", 14, "name", "Tall Hotel")),
process(SimpleFeature.create(
AREA_12K_SQ_M,
new HashMap<>(Map.of(
"tourism", "hotel",
"name", "Tall Hotel",
"height", "50"
)),
"osm", null, 0
)));
}
@Test
void zoom_15_tallStorageRental() {
assertFeatures(15,
List.of(Map.of("kind", "storage_rental", "min_zoom", 15, "name", "Self Storage")),
process(SimpleFeature.create(
AREA_12K_SQ_M,
new HashMap<>(Map.of(
"amenity", "storage_rental",
"name", "Self Storage",
"height", "100"
)),
"osm", null, 0
)));
}
// ========== Long name penalty ==========
@Test
void zoom_10_longName_46chars() {
assertFeatures(10,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 10, "name", "This Is A Very Long Name For A Park That Goes On Forever")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"leisure", "park",
"name", "This Is A Very Long Name For A Park That Goes On Forever"
)),
"osm", null, 0
)));
}
@Test
void zoom_8_mediumLongName_31chars() {
assertFeatures(8,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 8, "name", "Medium Length Park Name Here")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"leisure", "park",
"name", "Medium Length Park Name Here"
)),
"osm", null, 0
)));
}
// ========== Unnamed amenities late zoom ==========
@Test
void zoom_17_unnamedBench() {
assertFeatures(15,
List.of(Map.of("kind", "bench", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "bench")),
"osm", null, 0
)));
}
@Test
void zoom_17_unnamedATM() {
assertFeatures(15,
List.of(Map.of("kind", "atm", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("amenity", "atm")),
"osm", null, 0
)));
}
@Test
void zoom_17_unnamedPlayground() {
assertFeatures(15,
List.of(Map.of("kind", "playground", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "playground")),
"osm", null, 0
)));
}
@Test
void zoom_17_unnamedViewpoint() {
assertFeatures(15,
List.of(Map.of("kind", "viewpoint", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("tourism", "viewpoint")),
"osm", null, 0
)));
}
@Test
void zoom_18_namedPlaygroundPolygon() {
assertFeatures(15,
List.of(Map.of("kind", "playground"),
Map.of("kind", "playground", "min_zoom", 18, "name", "Fun Playground")),
process(SimpleFeature.create(
AREA_127_SQ_M,
new HashMap<>(Map.of(
"leisure", "playground",
"name", "Fun Playground"
)),
"osm", null, 0
)));
}
// ========== Other specific shop/tourism overrides ==========
@Test
void zoom_17_unnamedCarRepair() {
assertFeatures(15,
List.of(Map.of("kind", "car_repair", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("shop", "car_repair")),
"osm", null, 0
)));
}
@Test
void zoom_17_memorial() {
assertFeatures(15,
List.of(Map.of("kind", "memorial", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("historic", "memorial")),
"osm", null, 0
)));
}
@Test
void zoom_17_pitch() {
assertFeatures(15,
List.of(Map.of("kind", "pitch", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("leisure", "pitch")),
"osm", null, 0
)));
}
@Test
void zoom_17_bedAndBreakfast() {
assertFeatures(15,
List.of(Map.of("kind", "bed_and_breakfast", "min_zoom", 17)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("tourism", "bed_and_breakfast")),
"osm", null, 0
)));
}
// ========== Tests for kind assignments ==========
@Test
void kind_military_noSpecificType() {
assertFeatures(15,
List.of(Map.of("kind", "military", "min_zoom", 16)),
process(SimpleFeature.create(
newPoint(1, 1),
new HashMap<>(Map.of("landuse", "military")),
"osm", null, 0
)));
}
@Test
void kind_forest_fromLanduseForest() {
assertFeatures(15,
List.of(Map.of("kind", "forest"),
Map.of("kind", "forest", "min_zoom", 8, "name", "Test Forest")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"landuse", "forest",
"name", "Test Forest"
)),
"osm", null, 0
)));
}
@Test
void kind_forest_fromBoundaryProtectedArea() {
assertFeatures(15,
List.of(Map.of("kind", "forest"),
Map.of("kind", "forest", "min_zoom", 8, "name", "Protected Forest")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "protected_area",
"protect_class", "6",
"operator", "United States Forest Service",
"name", "Protected Forest"
)),
"osm", null, 0
)));
}
@Test
void kind_park_fromNationalParkUSFS() {
assertFeatures(15,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 8, "name", "National Forest Area")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "national_park",
"operator", "United States Forest Service",
"name", "National Forest Area"
)),
"osm", null, 0
)));
}
@Test
void kind_park_fromNationalParkProtectionTitle() {
assertFeatures(15,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 8, "name", "Test National Forest")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "national_park",
"protect_class", "6",
"protection_title", "National Forest",
"name", "Test National Forest"
)),
"osm", null, 0
)));
}
@Test
void kind_forest_fromLanduseForestProtectClass6() {
assertFeatures(15,
List.of(Map.of("kind", "forest"),
Map.of("kind", "forest", "min_zoom", 8, "name", "Protected Forest Area")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"landuse", "forest",
"protect_class", "6",
"name", "Protected Forest Area"
)),
"osm", null, 0
)));
}
@Test
void kind_forest_fromLanduseForestUSFS() {
assertFeatures(15,
List.of(Map.of("kind", "forest"),
Map.of("kind", "forest", "min_zoom", 8, "name", "USFS Forest")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"landuse", "forest",
"operator", "US Forest Service",
"name", "USFS Forest"
)),
"osm", null, 0
)));
}
@Test
void kind_park_fromNationalParkBoundaryConservation() {
assertFeatures(15,
List.of(Map.of("kind", "park"),
Map.of("kind", "park", "min_zoom", 8, "name", "Conservation Area")),
process(SimpleFeature.create(
AREA_1K_SQ_KM,
new HashMap<>(Map.of(
"boundary", "national_park",
"protection_title", "Conservation Area",
"name", "Conservation Area"
)),
"osm", null, 0
)));
}
@Test
void kind_zoo_kindFromLeisure() {
assertFeatures(15,
List.of(Map.of("kind", "zoo", "min_zoom", 16)),
process(SimpleFeature.create(