@@ -17,77 +17,90 @@ class SpearfishSymbolizer {
1717 context . fill ( ) ;
1818 }
1919}
20+ const sheet = new protomapsL . Sheet ( `
21+ <html>
22+ <body>
23+ <svg id="icon_0" width="99px" height="97px" xmlns="http://www.w3.org/2000/svg">
24+ <image href="data:image/svg+xml;base64,PHN2ZyBpZD0iaWNvbl82NCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgICAgPGltYWdlIGhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQkFBQUFBUUNBWUFBQUFmOC85aEFBQUFDWEJJV1hNQUFBN0VBQUFPeEFHVkt3NGJBQUFBMlVsRVFWUjRuTldQTVdvQ1lSQ0Z2MElDZ2xZaFZnRUwzZmNyZGlsczBteVJUdkFLa2xaSXdKM2ZpTjE2aGhoeUFCRkVjZ2J2WUtFbmtCUkpiNWtFSlRheXNNdFd5WVBYRFBPOW1RZC9YcjVHSlRkc1Rhb21wdm12TzBZbVB1T1FRcjRQeE5yRXR3L29wQzdITFM1TVRFd3NEdmFPdHdOOERCRGIwenh5eklkMWJoSkQraTFLWHN4T1lJSjN2a0dZM2ozZ1BnRmVqUnRjWnVvK2ROeWVCM2l4Skt0TXZQeUNtMGc4bS9neXNYOXlsRlBoT0tUZ3hZYzVYZ2ZYRkkrVnhKMkpkeE85MUlDQmFFZU83dm44b2M2VkQzak1YT1AvNkFmS0Ywd3dXeU9Oc3dBQUFBQkpSVTVFcmtKZ2dnPT0iIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIvPgogICAgPC9zdmc+" width="99" height="97" />
25+ </svg>
26+ </body>
27+ </html>
28+ ` ) ;
2029const pmtilesRules = new Map ( ) ;
21- pmtilesRules . set (
22- 'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles' ,
23- { theme : { theme : 'light' } }
24- ) ;
25- pmtilesRules . set (
26- 'https://maps4html.org/experiments/vector-tiles/pmtiles/spearfish.pmtiles?theme=light' ,
27- { theme : { theme : 'light' } }
28- ) ;
29- pmtilesRules . set (
30- 'https://maps4html.org/experiments/vector-tiles/pmtiles/spearfish.pmtiles?theme=dark' ,
31- { theme : { theme : 'dark' } }
32- ) ;
33- pmtilesRules . set (
34- 'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=41392fb7515533a5' ,
35- { theme : { theme : 'light' } }
36- ) ;
37- pmtilesRules . set (
38- 'http://localhost:8080/geoserver/gwc/service/wmts/rest/spearfish/OSMTILE/{z}/{y}/{x}?format=application/vnd.mapbox-vector-tile' ,
39- {
40- rules : {
41- PAINT_RULES : [
42- {
43- dataLayer : 'streams' ,
44- symbolizer : new protomapsL . LineSymbolizer ( { color : 'steelblue' , width : 2 } )
45- } ,
46- {
47- dataLayer : 'roads' ,
48- symbolizer : new protomapsL . LineSymbolizer ( { color : 'maroon' , width : 2 } )
49- } ,
50- {
51- dataLayer : 'restricted' ,
52- symbolizer : new protomapsL . PolygonSymbolizer ( {
53- fill : 'red' ,
54- opacity : 0.5
55- } )
56- } ,
57- {
58- dataLayer : 'restricted' ,
59- symbolizer : new protomapsL . LineSymbolizer ( { color : 'red' , width : 2 } )
60- } ,
61- {
62- dataLayer : 'archsites' ,
63- symbolizer : new SpearfishSymbolizer ( {
64- color : 'red' ,
65- shape : 'square'
66- } )
67- } ,
68- {
69- dataLayer : 'bugsites' ,
70- symbolizer : new SpearfishSymbolizer ( {
71- color : 'black' ,
72- shape : 'circle'
73- } )
74- }
75- ] ,
76- LABEL_RULES : [
77- {
78- dataLayer : 'archsites' ,
79- symbolizer : new protomapsL . CenteredTextSymbolizer ( {
80- labelProps : [ 'str1' ] ,
81- fill :'white' ,
82- width :2 ,
83- stroke :'black' ,
84- font :"600 16px sans-serif"
85- } ) ,
86- // note that filter is a property of a rule, not an option to a symbolizer
87- filter : ( z , f ) => { return f . props [ 'str1' ] . trim ( ) . toLowerCase ( ) !== 'no name' ; }
88- }
89- ]
30+ const pmtilesRulesReady = sheet . load ( ) . then ( ( ) => {
31+ pmtilesRules . set (
32+ 'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles' ,
33+ { theme : { theme : 'light' } }
34+ ) ;
35+ pmtilesRules . set (
36+ 'https://maps4html.org/experiments/vector-tiles/pmtiles/spearfish.pmtiles?theme=light' ,
37+ { theme : { theme : 'light' } }
38+ ) ;
39+ pmtilesRules . set (
40+ 'https://maps4html.org/experiments/vector-tiles/pmtiles/spearfish.pmtiles?theme=dark' ,
41+ { theme : { theme : 'dark' } }
42+ ) ;
43+ pmtilesRules . set (
44+ 'https://api.protomaps.com/tiles/v3/{z}/{x}/{y}.mvt?key=41392fb7515533a5' ,
45+ { theme : { theme : 'light' } }
46+ ) ;
47+ pmtilesRules . set (
48+ 'https://maps4html.org/experiments/vector-tiles/pmtiles/tiles/{z}/{y}/{x}.mvt?format=application/vnd.mapbox-vector-tile' ,
49+ {
50+ rules : {
51+ PAINT_RULES : [
52+ {
53+ dataLayer : 'streams' ,
54+ symbolizer : new protomapsL . LineSymbolizer ( { color : 'steelblue' , width : 2 } )
55+ } ,
56+ {
57+ dataLayer : 'roads' ,
58+ symbolizer : new protomapsL . LineSymbolizer ( { color : 'maroon' , width : 2 } )
59+ } ,
60+ {
61+ dataLayer : 'restricted' ,
62+ symbolizer : new protomapsL . PolygonSymbolizer ( {
63+ fill : 'red' ,
64+ opacity : 0.5
65+ } )
66+ } ,
67+ {
68+ dataLayer : 'restricted' ,
69+ symbolizer : new protomapsL . LineSymbolizer ( { color : 'red' , width : 2 } )
70+ } ,
71+ {
72+ dataLayer : 'archsites' ,
73+ symbolizer : new SpearfishSymbolizer ( {
74+ color : 'red' ,
75+ shape : 'square'
76+ } )
77+ } ,
78+ {
79+ dataLayer : 'bugsites' ,
80+ symbolizer : new SpearfishSymbolizer ( {
81+ color : 'black' ,
82+ shape : 'circle'
83+ } )
84+ }
85+ ] ,
86+ LABEL_RULES : [
87+ {
88+ dataLayer : 'archsites' ,
89+ symbolizer : new protomapsL . CenteredTextSymbolizer ( {
90+ labelProps : [ 'str1' ] ,
91+ fill :'white' ,
92+ width :2 ,
93+ stroke :'black' ,
94+ font :"600 16px sans-serif"
95+ } ) ,
96+ // note that filter is a property of a rule, not an option to a symbolizer
97+ filter : ( z , f ) => { return f . props [ 'str1' ] . trim ( ) . toLowerCase ( ) !== 'no name' ; }
98+ }
99+ ]
100+ }
90101 }
91- }
92- ) ;
93- export { pmtilesRules } ;
102+ ) ;
103+ return pmtilesRules ;
104+ } ) ;
105+
106+ export { pmtilesRules , pmtilesRulesReady } ;
0 commit comments