Skip to content

Commit

Permalink
[AUTO] Sync MapML Build
Browse files Browse the repository at this point in the history
  • Loading branch information
prushforth committed Nov 15, 2024
1 parent 13c8764 commit 50e6e84
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 84 deletions.
2 changes: 1 addition & 1 deletion dist/mapml.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mapml.js.map

Large diffs are not rendered by default.

177 changes: 95 additions & 82 deletions dist/pmtilesRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@
* as described here: https://docs.protomaps.com/pmtiles/leaflet, and as
* exemplified below.
*/
const sheet = new protomapsL.Sheet(`
<html>
<body>
<svg id="icon_0" width="99px" height="97px" xmlns="http://www.w3.org/2000/svg">
<image href="data:image/svg+xml;base64,PHN2ZyBpZD0iaWNvbl82NCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgICAgPGltYWdlIGhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQkFBQUFBUUNBWUFBQUFmOC85aEFBQUFDWEJJV1hNQUFBN0VBQUFPeEFHVkt3NGJBQUFBMlVsRVFWUjRuTldQTVdvQ1lSQ0Z2MElDZ2xZaFZnRUwzZmNyZGlsczBteVJUdkFLa2xaSXdKM2ZpTjE2aGhoeUFCRkVjZ2J2WUtFbmtCUkpiNWtFSlRheXNNdFd5WVBYRFBPOW1RZC9YcjVHSlRkc1Rhb21wdm12TzBZbVB1T1FRcjRQeE5yRXR3L29wQzdITFM1TVRFd3NEdmFPdHdOOERCRGIwenh5eklkMWJoSkQraTFLWHN4T1lJSjN2a0dZM2ozZ1BnRmVqUnRjWnVvK2ROeWVCM2l4Skt0TXZQeUNtMGc4bS9neXNYOXlsRlBoT0tUZ3hZYzVYZ2ZYRkkrVnhKMkpkeE85MUlDQmFFZU83dm44b2M2VkQzak1YT1AvNkFmS0Ywd3dXeU9Oc3dBQUFBQkpSVTVFcmtKZ2dnPT0iIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIvPgogICAgPC9zdmc+" width="99" height="97" />
</svg>
</body>
</html>
`);

class SpearfishSymbolizer {
constructor(options) {
Expand Down Expand Up @@ -88,87 +97,91 @@ class SpearfishSymbolizer {
*/
const pmtilesRules = new Map();
pmtilesRules.set(
'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles?theme=light',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles?theme=dark',
{ theme: { theme: 'dark' } }
);
pmtilesRules.set(
'https://api.protomaps.com/tiles/v3/{bing}/{bong}/{bang}.mvt?key=41392fb7515533a5',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'http://localhost:8080/geoserver/gwc/service/wmts/rest/spearfish/OSMTILE/{foo}/{baz}/{bar}?format=application/vnd.mapbox-vector-tile',
{
rules: {
PAINT_RULES: [
{
dataLayer: 'streams',
symbolizer: new protomapsL.LineSymbolizer({
color: 'steelblue',
width: 2
})
},
{
dataLayer: 'roads',
symbolizer: new protomapsL.LineSymbolizer({
color: 'maroon',
width: 2
})
},
{
dataLayer: 'restricted',
symbolizer: new protomapsL.PolygonSymbolizer({
fill: 'red',
opacity: 0.5
})
},
{
dataLayer: 'restricted',
symbolizer: new protomapsL.LineSymbolizer({
color: 'red',
width: 2
})
},
{
dataLayer: 'archsites',
symbolizer: new SpearfishSymbolizer({
color: 'red',
shape: 'square'
})
},
{
dataLayer: 'bugsites',
symbolizer: new SpearfishSymbolizer({
color: 'black',
shape: 'circle'
})
}
],
LABEL_RULES: [
{
dataLayer: 'archsites',
symbolizer: new protomapsL.CenteredTextSymbolizer({
labelProps: ['str1'],
fill: 'white',
width: 2,
stroke: 'black',
font: '600 16px sans-serif'
}),
// note that filter is a property of a rule, not an option to a symbolizer
filter: (z, f) => {
return f.props.str1.trim().toLowerCase() !== 'no name';
const pmtilesRulesReady = sheet.load().then(() => {
pmtilesRules.set(
'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles?theme=light',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'https://data.source.coop/protomaps/openstreetmap/tiles/v3.pmtiles?theme=dark',
{ theme: { theme: 'dark' } }
);
pmtilesRules.set(
'https://api.protomaps.com/tiles/v3/{bing}/{bong}/{bang}.mvt?key=41392fb7515533a5',
{ theme: { theme: 'light' } }
);
pmtilesRules.set(
'http://localhost:8080/geoserver/gwc/service/wmts/rest/spearfish/OSMTILE/{foo}/{baz}/{bar}?format=application/vnd.mapbox-vector-tile',
{
rules: {
PAINT_RULES: [
{
dataLayer: 'streams',
symbolizer: new protomapsL.LineSymbolizer({
color: 'steelblue',
width: 2
})
},
{
dataLayer: 'roads',
symbolizer: new protomapsL.LineSymbolizer({
color: 'maroon',
width: 2
})
},
{
dataLayer: 'restricted',
symbolizer: new protomapsL.PolygonSymbolizer({
fill: 'red',
opacity: 0.5
})
},
{
dataLayer: 'restricted',
symbolizer: new protomapsL.LineSymbolizer({
color: 'red',
width: 2
})
},
{
dataLayer: 'archsites',
symbolizer: new SpearfishSymbolizer({
color: 'red',
shape: 'square'
})
},
{
dataLayer: 'bugsites',
symbolizer: new SpearfishSymbolizer({
color: 'black',
shape: 'circle'
})
}
}
]
],
LABEL_RULES: [
{
dataLayer: 'archsites',
symbolizer: new protomapsL.CenteredTextSymbolizer({
labelProps: ['str1'],
fill: 'white',
width: 2,
stroke: 'black',
font: '600 16px sans-serif'
}),
// note that filter is a property of a rule, not an option to a symbolizer
filter: (z, f) => {
return f.props.str1.trim().toLowerCase() !== 'no name';
}
}
]
}
}
}
);
export { pmtilesRules };
);
return pmtilesRules;
});

export { pmtilesRules, pmtilesRulesReady };

0 comments on commit 50e6e84

Please sign in to comment.