1
1
package com .protomaps .basemap .layers ;
2
2
3
3
import static com .onthegomap .planetiler .util .Parse .parseDoubleOrNull ;
4
+ import static com .protomaps .basemap .feature .Matcher .entry ;
5
+ import static com .protomaps .basemap .feature .Matcher .fromTag ;
6
+ import static com .protomaps .basemap .feature .Matcher .getString ;
7
+ import static com .protomaps .basemap .feature .Matcher .use ;
8
+ import static com .protomaps .basemap .feature .Matcher .with ;
9
+ import static com .protomaps .basemap .feature .Matcher .without ;
4
10
5
11
import com .onthegomap .planetiler .FeatureCollector ;
6
12
import com .onthegomap .planetiler .ForwardingProfile ;
7
13
import com .onthegomap .planetiler .VectorTile ;
14
+ import com .onthegomap .planetiler .expression .MultiExpression ;
8
15
import com .onthegomap .planetiler .geo .GeoUtils ;
9
16
import com .onthegomap .planetiler .geo .GeometryException ;
10
17
import com .onthegomap .planetiler .reader .SourceFeature ;
13
20
import com .protomaps .basemap .feature .QrankDb ;
14
21
import com .protomaps .basemap .names .OsmNames ;
15
22
import java .util .List ;
23
+ import java .util .Map ;
16
24
17
25
public class Pois implements ForwardingProfile .LayerPostProcessor {
18
26
@@ -33,15 +41,82 @@ public String name() {
33
41
Math .pow (GeoUtils .metersToPixelAtEquator (0 , Math .sqrt (70_000 )) / 256d , 2 );
34
42
private static final double LOG2 = Math .log (2 );
35
43
44
+ private static final MultiExpression .Index <Map <String , Object >> index = MultiExpression .of (List .of (
45
+ entry (
46
+ with ("aeroway" , "aerodrome" ),
47
+ use ("kind" , "aerodrome" ),
48
+ use ("kindDetail" , "" ),
49
+ use ("minZoom" , 13 )
50
+ ),
51
+ entry (
52
+ with ("aeroway" , "aerodrome" ),
53
+ with ("iata" ),
54
+ use ("minZoom" , 11 )
55
+ ),
56
+ entry (
57
+ with ("aeroway" , "aerodrome" ),
58
+ with ("aerodrome" ),
59
+ use ("kindDetail" , fromTag ("aerodrome" ))
60
+ ),
61
+ entry (
62
+ with ("amenity" ),
63
+ use ("kind" , "other" ),
64
+ use ("kindDetail" , "" ),
65
+ use ("minZoom" , 15 )
66
+ ),
67
+ entry (
68
+ with ("amenity" , "hospital" ),
69
+ use ("kind" , "hospital" ),
70
+ use ("minZoom" , 12 )
71
+ ),
72
+ entry (
73
+ with ("amenity" , "library" , "post_office" , "townhall" ),
74
+ use ("kind" , fromTag ("amenity" )),
75
+ use ("minZoom" , 13 )
76
+ ),
77
+ entry (
78
+ with ("amenity" , "university" , "college" ),
79
+ use ("kind" , fromTag ("amenity" )),
80
+ use ("minZoom" , 14 )
81
+ ),
82
+ entry (
83
+ with ("amenity" , "school" , "cafe" ),
84
+ use ("kind" , fromTag ("amenity" ))
85
+ ),
86
+ entry (
87
+ with ("landuse" , "cemetery" , "recreation_ground" , "winter_sports" , "quarry" , "park" , "forest" , "military" ,
88
+ "village_green" , "allotments" ),
89
+ use ("kind" , "other" ),
90
+ use ("kindDetail" , "" ),
91
+ use ("minZoom" , 15 )
92
+ ),
93
+ entry (
94
+ with ("landuse" , "cemetery" ),
95
+ use ("kind" , "cemetery" ),
96
+ use ("minZoom" , 14 )
97
+ ),
98
+ entry (
99
+ with ("landuse" , "military" ),
100
+ use ("kind" , "military" )
101
+ ),
102
+ entry (
103
+ with ("landuse" , "military" ),
104
+ with ("military" , "naval_base" , "airfield" )
105
+ use ("kind" , fromTag ("military" ))
106
+ )
107
+
108
+ )).index ();
109
+
36
110
public void processOsm (SourceFeature sf , FeatureCollector features ) {
37
- if ((sf .isPoint () || sf .canBePolygon ()) && (sf .hasTag ("aeroway" , "aerodrome" ) ||
38
- sf .hasTag ("amenity" ) ||
111
+ if ((sf .isPoint () || sf .canBePolygon ()) && (
112
+ // sf.hasTag("aeroway", "aerodrome") ||
113
+ // sf.hasTag("amenity") ||
39
114
sf .hasTag ("attraction" ) ||
40
115
sf .hasTag ("boundary" , "national_park" , "protected_area" ) ||
41
116
sf .hasTag ("craft" ) ||
42
117
sf .hasTag ("historic" ) ||
43
- sf .hasTag ("landuse" , "cemetery" , "recreation_ground" , "winter_sports" , "quarry" , "park" , "forest" , "military" ,
44
- "village_green" , "allotments" ) ||
118
+ // sf.hasTag("landuse", "cemetery", "recreation_ground", "winter_sports", "quarry", "park", "forest", "military",
119
+ // "village_green", "allotments") ||
45
120
sf .hasTag ("leisure" ) ||
46
121
sf .hasTag ("natural" , "beach" , "peak" ) ||
47
122
sf .hasTag ("railway" , "station" ) ||
@@ -59,34 +134,34 @@ public void processOsm(SourceFeature sf, FeatureCollector features) {
59
134
}
60
135
61
136
if (sf .hasTag ("aeroway" , "aerodrome" )) {
62
- kind = sf .getString ("aeroway" );
63
- minZoom = 13 ;
137
+ // kind = sf.getString("aeroway");
138
+ // minZoom = 13;
64
139
65
- // Emphasize large international airports earlier
66
- if (kind .equals ("aerodrome" ) && sf .hasTag ("iata" )) {
67
- minZoom -= 2 ;
68
- }
140
+ // // Emphasize large international airports earlier
141
+ // if (kind.equals("aerodrome") && sf.hasTag("iata")) {
142
+ // minZoom -= 2;
143
+ // }
69
144
70
- if (sf .hasTag ("aerodrome" )) {
71
- kindDetail = sf .getString ("aerodrome" );
72
- }
145
+ // if (sf.hasTag("aerodrome")) {
146
+ // kindDetail = sf.getString("aerodrome");
147
+ // }
73
148
} else if (sf .hasTag ("amenity" , "university" , "college" )) {
74
- kind = sf .getString ("amenity" );
75
- // One would think University should be earlier, but there are lots of dinky node only places
76
- // So if the university has a large area, it'll naturally improve it's zoom in the next section...
77
- minZoom = 14 ;
149
+ // kind = sf.getString("amenity");
150
+ // // One would think University should be earlier, but there are lots of dinky node only places
151
+ // // So if the university has a large area, it'll naturally improve it's zoom in the next section...
152
+ // minZoom = 14;
78
153
} else if (sf .hasTag ("amenity" , "hospital" )) {
79
- kind = sf .getString ("amenity" );
80
- minZoom = 12 ;
154
+ // kind = sf.getString("amenity");
155
+ // minZoom = 12;
81
156
} else if (sf .hasTag ("amenity" , "library" , "post_office" , "townhall" )) {
82
- kind = sf .getString ("amenity" );
83
- minZoom = 13 ;
157
+ // kind = sf.getString("amenity");
158
+ // minZoom = 13;
84
159
} else if (sf .hasTag ("amenity" , "school" )) {
85
- kind = sf .getString ("amenity" );
86
- minZoom = 15 ;
87
- } else if (sf .hasTag ("amenity" , "cafe" )) {
88
- kind = sf .getString ("amenity" );
89
- minZoom = 15 ;
160
+ // // kind = sf.getString("amenity");
161
+ // // minZoom = 15;
162
+ // } else if (sf.hasTag("amenity", "cafe")) {
163
+ // kind = sf.getString("amenity");
164
+ // minZoom = 15;
90
165
} else if (sf .hasTag ("landuse" , "cemetery" )) {
91
166
kind = sf .getString ("landuse" );
92
167
minZoom = 14 ;
0 commit comments