@abi-software/flatmap-viewer 2.7.2 → 2.7.3-a.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/assets/index.css +1 -0
  2. package/dist/index.js +80577 -0
  3. package/dist/lib/index.d.ts +4 -0
  4. package/package.json +10 -7
  5. package/lib/index.ts +0 -10
  6. package/src/contextmenu.js +0 -97
  7. package/src/controls/annotation.js +0 -302
  8. package/src/controls/controls.js +0 -645
  9. package/src/controls/flightpaths.js +0 -95
  10. package/src/controls/info.js +0 -291
  11. package/src/controls/minimap.js +0 -442
  12. package/src/controls/paths.js +0 -143
  13. package/src/controls/search.js +0 -113
  14. package/src/controls/systems.js +0 -75
  15. package/src/controls/taxons.js +0 -73
  16. package/src/flatmap-viewer.js +0 -1789
  17. package/src/images.js +0 -66
  18. package/src/interactions.js +0 -1569
  19. package/src/layers/cluster.js +0 -177
  20. package/src/layers/filter.js +0 -310
  21. package/src/layers/flightpaths.js +0 -383
  22. package/src/layers/index.js +0 -478
  23. package/src/layers/styling.js +0 -1077
  24. package/src/main.js +0 -272
  25. package/src/mapserver.js +0 -64
  26. package/src/mathjax.js +0 -100
  27. package/src/pathways.js +0 -427
  28. package/src/search.js +0 -137
  29. package/src/systems.js +0 -146
  30. package/src/utils.js +0 -152
  31. package/static/css/flatmap-viewer.css +0 -238
  32. package/static/icons/favicon.ico +0 -0
  33. package/static/images/active.png +0 -0
  34. package/static/images/inactive.png +0 -0
  35. package/static/images/reset-map-active.png +0 -0
  36. package/static/images/reset-map-button.png +0 -0
  37. package/static/images/rounded-background.png +0 -0
  38. package/static/images/zoom-in-active.png +0 -0
  39. package/static/images/zoom-in-button.png +0 -0
  40. package/static/images/zoom-out-active.png +0 -0
  41. package/static/images/zoom-out-button.png +0 -0
  42. package/thirdParty/maplibre-gl-svg/CHANGELOG.md +0 -13
  43. package/thirdParty/maplibre-gl-svg/LICENSE +0 -21
  44. package/thirdParty/maplibre-gl-svg/LICENSE.md +0 -21
  45. package/thirdParty/maplibre-gl-svg/README.md +0 -24
  46. package/thirdParty/maplibre-gl-svg/assets/Add custom SVG template to template manager.jpg +0 -0
  47. package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as HTML markers.jpg +0 -0
  48. package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as symbols.jpg +0 -0
  49. package/thirdParty/maplibre-gl-svg/assets/Fill polygon with built-in SVG template.jpg +0 -0
  50. package/thirdParty/maplibre-gl-svg/assets/HTML Marker with Custom SVG Template.jpg +0 -0
  51. package/thirdParty/maplibre-gl-svg/assets/HTML Marker with built-in SVG template.jpg +0 -0
  52. package/thirdParty/maplibre-gl-svg/assets/Line layer with built-in SVG template.jpg +0 -0
  53. package/thirdParty/maplibre-gl-svg/assets/Load SVG from URL.jpg +0 -0
  54. package/thirdParty/maplibre-gl-svg/assets/SVG template options.jpg +0 -0
  55. package/thirdParty/maplibre-gl-svg/assets/Smiley_face_changed.svg +0 -37
  56. package/thirdParty/maplibre-gl-svg/assets/Symbol layer with built-in SVG template.jpg +0 -0
  57. package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up-thin.png +0 -0
  58. package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up.png +0 -0
  59. package/thirdParty/maplibre-gl-svg/assets/image-templates/car.png +0 -0
  60. package/thirdParty/maplibre-gl-svg/assets/image-templates/checker-rotated.png +0 -0
  61. package/thirdParty/maplibre-gl-svg/assets/image-templates/checker.png +0 -0
  62. package/thirdParty/maplibre-gl-svg/assets/image-templates/circles-spaced.png +0 -0
  63. package/thirdParty/maplibre-gl-svg/assets/image-templates/circles.png +0 -0
  64. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-down.png +0 -0
  65. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-up.png +0 -0
  66. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-down.png +0 -0
  67. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-up.png +0 -0
  68. package/thirdParty/maplibre-gl-svg/assets/image-templates/dots.png +0 -0
  69. package/thirdParty/maplibre-gl-svg/assets/image-templates/flag-triangle.png +0 -0
  70. package/thirdParty/maplibre-gl-svg/assets/image-templates/flag.png +0 -0
  71. package/thirdParty/maplibre-gl-svg/assets/image-templates/grid-lines.png +0 -0
  72. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded-thick.png +0 -0
  73. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded.png +0 -0
  74. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-thick.png +0 -0
  75. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon.png +0 -0
  76. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-arrow.png +0 -0
  77. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-ball-pin.png +0 -0
  78. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-circle.png +0 -0
  79. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-flat.png +0 -0
  80. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-cluster.png +0 -0
  81. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded-cluster.png +0 -0
  82. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded.png +0 -0
  83. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square.png +0 -0
  84. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-thick.png +0 -0
  85. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker.png +0 -0
  86. package/thirdParty/maplibre-gl-svg/assets/image-templates/pin-round.png +0 -0
  87. package/thirdParty/maplibre-gl-svg/assets/image-templates/pin.png +0 -0
  88. package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-lines.png +0 -0
  89. package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-stripes.png +0 -0
  90. package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square-thick.png +0 -0
  91. package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square.png +0 -0
  92. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-left.png +0 -0
  93. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-up.png +0 -0
  94. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-thick.png +0 -0
  95. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle.png +0 -0
  96. package/thirdParty/maplibre-gl-svg/assets/image-templates/x-fill.png +0 -0
  97. package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag-vertical.png +0 -0
  98. package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag.png +0 -0
  99. package/thirdParty/maplibre-gl-svg/build/build.js +0 -210
  100. package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.js +0 -339
  101. package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.min.js +0 -4
  102. package/thirdParty/maplibre-gl-svg/docs/docs.md +0 -375
  103. package/thirdParty/maplibre-gl-svg/examples/Add custom SVG template to template manager.html +0 -101
  104. package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as HTML markers.html +0 -82
  105. package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as symbols.html +0 -124
  106. package/thirdParty/maplibre-gl-svg/examples/Fill polygon with built-in SVG template.html +0 -94
  107. package/thirdParty/maplibre-gl-svg/examples/HTML Marker with Custom SVG Template.html +0 -86
  108. package/thirdParty/maplibre-gl-svg/examples/HTML Marker with built-in SVG template.html +0 -83
  109. package/thirdParty/maplibre-gl-svg/examples/Line layer with built-in SVG template.html +0 -129
  110. package/thirdParty/maplibre-gl-svg/examples/Load SVG from URL.html +0 -96
  111. package/thirdParty/maplibre-gl-svg/examples/SVG template options.html +0 -264
  112. package/thirdParty/maplibre-gl-svg/examples/Symbol layer with built-in SVG template.html +0 -93
  113. package/thirdParty/maplibre-gl-svg/index.html +0 -151
  114. package/thirdParty/maplibre-gl-svg/package-lock.json +0 -5882
  115. package/thirdParty/maplibre-gl-svg/package.json +0 -49
  116. package/thirdParty/maplibre-gl-svg/src/SvgManager.ts +0 -186
  117. package/thirdParty/maplibre-gl-svg/src/SvgTemplateManager.ts +0 -144
  118. package/thirdParty/maplibre-gl-svg/src/index.ts +0 -4
  119. package/thirdParty/maplibre-gl-svg/tsconfig.json +0 -31
  120. package/thirdParty/maplibre-gl-svg/typings/index.d.ts +0 -111
@@ -1,124 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>All built-in SVG templates as symbols</title>
5
- <meta charset='utf-8'>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
8
- <script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
9
-
10
- <script src="../dist/maplibre-gl-svg.js"></script>
11
-
12
- <style>
13
- body { margin: 0; padding: 0; }
14
- html, body { height: 100%; }
15
- #map { position: relative; width:100%; height:100%; }
16
- fieldset { position: absolute; top: 10px; left: 10px; width: 300px;z-index: 1; background-color: white;}
17
- legend {background-color: white;border-radius: 5px;border:1px solid #000;}
18
- </style>
19
- </head>
20
- <body>
21
- <div id="map"></div>
22
-
23
- <fieldset>
24
- <legend>All built-in SVG templates as symbols</legend>
25
- This sample shows all the built-in icon templates rendered on a symbol layer. The primary color is teal and the secondary color is white.
26
- </fieldset>
27
-
28
- <script>
29
- const center = [20, -10];
30
- var marker, svgManager;
31
- var datasource = {
32
- 'type': 'FeatureCollection',
33
- 'features': []
34
- };
35
- var imagePromises = [];
36
-
37
- const map = new maplibregl.Map({
38
- container: 'map',
39
- center: center,
40
- zoom: 4,
41
- style: {
42
- 'version': 8,
43
- 'sources': {
44
- },
45
- 'layers': [
46
- {
47
- "id": "background",
48
- "type": "background",
49
- "paint": {
50
- "background-color": "gray"
51
- }
52
- }
53
- ],
54
- "glyphs": "http://fonts.openmaptiles.org/{fontstack}/{range}.pbf",
55
- },
56
- });
57
-
58
- map.on('load', () => {
59
-
60
- //Create a new instance of the SVG manager.
61
- svgManager = new maplibregl.SvgManager(map);
62
-
63
- //Get all image templates available in the map control.
64
- var keys = maplibregl.SvgTemplateManager.getAllTemplateNames();
65
-
66
- //Create a grid of points, each using a different SVG template.
67
- var cols = 6;
68
- var rows = Math.ceil(keys.length / cols);
69
-
70
- for (var row = 0; row < rows; row++) {
71
- for (var col = 0; col < cols; col++) {
72
- var idx = cols * row + col;
73
- if (idx < keys.length) {
74
- createIcon(keys[idx], row, col);
75
- }
76
- }
77
- }
78
-
79
- //Load the SVG template promises all at once.
80
- Promise.all(imagePromises).then(() => {
81
-
82
- //Add a layer to display the points.
83
- map.addLayer({
84
- 'id': 'points-layer',
85
- 'type': 'symbol',
86
- 'source': {
87
- 'type': 'geojson',
88
- 'data': datasource
89
- },
90
- 'layout': {
91
- 'icon-image': ['get', 'imageId'],
92
- 'icon-allow-overlap': true,
93
- 'icon-ignore-placement': true,
94
- 'text-field': ['get', 'imageId'],
95
- 'text-offset': [0, 2],
96
- 'text-allow-overlap': true,
97
- 'text-ignore-placement': true,
98
- 'text-font': ['Open Sans Semibold'],
99
- 'text-size': 12,
100
- 'text-anchor': 'top'
101
- }
102
- });
103
- });
104
- });
105
-
106
- function createIcon(id, row, col) {
107
- //Capture the promise to create the image from the template.
108
- imagePromises.push(svgManager.createFromTemplate(id, id, 'teal', '#fff', 1));
109
-
110
- //Add a point to the data source to render the image.
111
- datasource.features.push({
112
- 'type': 'Feature',
113
- 'properties': {
114
- 'imageId': id
115
- },
116
- 'geometry': {
117
- 'type': 'Point',
118
- 'coordinates': [8 * col, -3.5 * row]
119
- }
120
- });
121
- }
122
- </script>
123
- </body>
124
- </html>
@@ -1,94 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Fill polygon with built-in SVG template</title>
5
- <meta charset='utf-8'>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
8
- <script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
9
-
10
- <script src="../dist/maplibre-gl-svg.js"></script>
11
-
12
- <style>
13
- body { margin: 0; padding: 0; }
14
- html, body { height: 100%; }
15
- #map { position: relative; width:100%; height:100%; }
16
- fieldset { position: absolute; top: 10px; left: 10px; width: 300px;z-index: 1; background-color: white;}
17
- legend {background-color: white;border-radius: 5px;border:1px solid #000;}
18
- </style>
19
- </head>
20
- <body>
21
- <div id="map"></div>
22
-
23
- <fieldset>
24
- <legend>Fill polygon with built-in SVG template</legend>
25
- This sample shows how to use an SVG template as a fill pattern for a polygon.
26
- </fieldset>
27
-
28
- <script>
29
- var marker, svgManager;
30
-
31
- const map = new maplibregl.Map({
32
- container: 'map',
33
- style: {
34
- 'version': 8,
35
- 'sources': {
36
- 'osm-tiles': {
37
- 'type': 'raster',
38
- 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ],
39
- 'tileSize': 256,
40
- 'attribution': '&copy; <a href="https://www.openstreetmap.org/about" target="_blank">OpenStreetMap</a>'
41
- }
42
- },
43
- 'layers': [
44
- {
45
- 'id': 'osm-tiles',
46
- 'type': 'raster',
47
- 'source': 'osm-tiles',
48
- 'minzoom': 0,
49
- 'maxzoom': 19
50
- }
51
- ]
52
- },
53
- zoom: 2
54
- });
55
-
56
- map.on('load', () => {
57
- //Create a new instance of the SVG manager.
58
- svgManager = new maplibregl.SvgManager(map);
59
-
60
- //Load an SVG templated icon into the map.
61
- svgManager.createFromTemplate('myFillPattern', 'dots', 'red', 'transparent').then(() => {
62
-
63
- //Add a layer to display a filled polygon.
64
- map.addLayer({
65
- 'id': 'fill-layer',
66
- 'type': 'fill',
67
- 'source': {
68
- 'type': 'geojson',
69
- 'data': {
70
- 'type': 'FeatureCollection',
71
- 'features': [
72
- {
73
- 'type': 'Feature',
74
- 'properties': {
75
- },
76
- 'geometry': {
77
- 'type': 'Polygon',
78
- 'coordinates': [[[-50, -20], [0, 40], [50, -20], [-50, -20]]]
79
- }
80
- }
81
- ]
82
- }
83
- },
84
- 'paint': {
85
- //Apply the fill pattern.
86
- 'fill-pattern': 'myFillPattern',
87
- 'fill-opacity': 1
88
- }
89
- });
90
- });
91
- });
92
- </script>
93
- </body>
94
- </html>
@@ -1,86 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>HTML Marker with Custom SVG Template</title>
5
- <meta charset='utf-8'>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
8
- <script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
9
-
10
- <script src="../dist/maplibre-gl-svg.js"></script>
11
-
12
- <style>
13
- body { margin: 0; padding: 0; }
14
- html, body { height: 100%; }
15
- #map { position: relative; width:100%; height:100%; }
16
- fieldset { position: absolute; top: 10px; left: 10px; width: 300px;z-index: 1; background-color: white;}
17
- legend {background-color: white;border-radius: 5px;border:1px solid #000;}
18
- </style>
19
- </head>
20
- <body>
21
- <div id="map"></div>
22
-
23
- <fieldset>
24
- <legend>HTML Marker with Custom SVG Template</legend>
25
- This sample shows how to create a custom SVG template and use it with the Html Marker class.
26
- <br/><br/>
27
- <input type="button" value="Update marker color" onclick="updateMarker()">
28
- </fieldset>
29
-
30
- <script>
31
- const center = [-74.5, 40];
32
- var marker;
33
-
34
- const map = new maplibregl.Map({
35
- container: 'map',
36
- style: {
37
- 'version': 8,
38
- 'sources': {
39
- 'osm-tiles': {
40
- 'type': 'raster',
41
- 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ],
42
- 'tileSize': 256,
43
- 'attribution': '&copy; <a href="https://www.openstreetmap.org/about" target="_blank">OpenStreetMap</a>'
44
- }
45
- },
46
- 'layers': [
47
- {
48
- 'id': 'osm-tiles',
49
- 'type': 'raster',
50
- 'source': 'osm-tiles',
51
- 'minzoom': 0,
52
- 'maxzoom': 19
53
- }
54
- ]
55
- },
56
- center: center, // starting position
57
- zoom: 2 // starting zoom
58
- });
59
-
60
- map.on('load', () => {
61
- // Add a custom SVG template to SvgTemplateManager.
62
- maplibregl.SvgTemplateManager.addTemplate('myCustomTemaplate', '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="30" height="37" viewBox="0 0 30 37" xml:space="preserve"><rect x="0" y="0" rx="8" ry="8" width="30" height="30" fill="{color}"/><polygon fill="{color}" points="10,29 20,29 15,37 10,29"/><text x="15" y="20" style="font-size:16px;font-family:arial;fill:#ffffff;" text-anchor="middle">{text}</text></svg>');
63
-
64
- // Create marker element from our custom SVG template.
65
- const el = maplibregl.SvgTemplateManager.getElement('myCustomTemaplate', 'AB', 'red');
66
-
67
- // Add marker to map
68
- marker = new maplibregl.Marker({
69
- element: el,
70
- anchor: 'bottom'
71
- }).setLngLat(center).addTo(map);
72
- });
73
-
74
- function updateMarker() {
75
- //Get a random color.
76
- const color = '#' + Math.floor(Math.random()*16777215).toString(16);
77
-
78
- //Create a new marker element from SVG template. If desired, a completely new template could be used.
79
- const el = maplibregl.SvgTemplateManager.getElement('myCustomTemaplate', 'AB', color);
80
-
81
- //Replace the inner HTML of the marker with the new SVG template.
82
- marker.getElement().innerHTML = el.innerHTML;
83
- }
84
- </script>
85
- </body>
86
- </html>
@@ -1,83 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>HTML Marker with built-in SVG template</title>
5
- <meta charset='utf-8'>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
8
- <script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
9
-
10
- <script src="../dist/maplibre-gl-svg.js"></script>
11
-
12
- <style>
13
- body { margin: 0; padding: 0; }
14
- html, body { height: 100%; }
15
- #map { position: relative; width:100%; height:100%; }
16
- fieldset { position: absolute; top: 10px; left: 10px; width: 300px;z-index: 1; background-color: white;}
17
- legend {background-color: white;border-radius: 5px;border:1px solid #000;}
18
- </style>
19
- </head>
20
- <body>
21
- <div id="map"></div>
22
-
23
- <fieldset>
24
- <legend>HTML Marker with built-in SVG template</legend>
25
- This sample shows how use SVG templates with an HTML marker, and how to update the marker with a new template.
26
- <br/><br/>
27
- <input type="button" value="Update marker color" onclick="updateMarker()">
28
- </fieldset>
29
-
30
- <script>
31
- const center = [-74.5, 40];
32
- var marker;
33
-
34
- const map = new maplibregl.Map({
35
- container: 'map',
36
- style: {
37
- 'version': 8,
38
- 'sources': {
39
- 'osm-tiles': {
40
- 'type': 'raster',
41
- 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ],
42
- 'tileSize': 256,
43
- 'attribution': '&copy; <a href="https://www.openstreetmap.org/about" target="_blank">OpenStreetMap</a>'
44
- }
45
- },
46
- 'layers': [
47
- {
48
- 'id': 'osm-tiles',
49
- 'type': 'raster',
50
- 'source': 'osm-tiles',
51
- 'minzoom': 0,
52
- 'maxzoom': 19
53
- }
54
- ]
55
- },
56
- center: center, // starting position
57
- zoom: 2 // starting zoom
58
- });
59
-
60
- map.on('load', () => {
61
- // Create marker element from SVG template.
62
- const el = maplibregl.SvgTemplateManager.getElement('marker-arrow', 'AB', 'red', 'pink');
63
-
64
- // Add marker to map
65
- marker = new maplibregl.Marker({
66
- element: el,
67
- anchor: 'bottom'
68
- }).setLngLat(center).addTo(map);
69
- });
70
-
71
- function updateMarker() {
72
- //Get a random color.
73
- const color = '#' + Math.floor(Math.random()*16777215).toString(16);
74
-
75
- //Create a new marker element from SVG template. If desired, a completely new template could be used.
76
- const el = maplibregl.SvgTemplateManager.getElement('marker-arrow', 'AB', color, 'pink');
77
-
78
- //Replace the inner HTML of the marker with the new SVG template.
79
- marker.getElement().innerHTML = el.innerHTML;
80
- }
81
- </script>
82
- </body>
83
- </html>
@@ -1,129 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Line layer with built-in SVG template</title>
5
- <meta charset='utf-8'>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
8
- <script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
9
-
10
- <script src="../dist/maplibre-gl-svg.js"></script>
11
-
12
- <style>
13
- body { margin: 0; padding: 0; }
14
- html, body { height: 100%; }
15
- #map { position: relative; width:100%; height:100%; }
16
- fieldset { position: absolute; top: 10px; left: 10px; width: 300px;z-index: 1; background-color: white;}
17
- legend {background-color: white;border-radius: 5px;border:1px solid #000;}
18
- </style>
19
- </head>
20
- <body>
21
- <div id="map"></div>
22
-
23
- <fieldset>
24
- <legend>Line layer with built-in SVG template</legend>
25
- This sample shows how to use a built-in SVG template with a line layer.
26
- </fieldset>
27
-
28
- <script>
29
- const center = [-74.5, 40];
30
- var marker, svgManager;
31
-
32
- const map = new maplibregl.Map({
33
- container: 'map',
34
- center: [-122.135, 47.65],
35
- zoom: 12,
36
- style: {
37
- 'version': 8,
38
- 'sources': {
39
- 'osm-tiles': {
40
- 'type': 'raster',
41
- 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ],
42
- 'tileSize': 256,
43
- 'attribution': '&copy; <a href="https://www.openstreetmap.org/about" target="_blank">OpenStreetMap</a>'
44
- }
45
- },
46
- 'layers': [
47
- {
48
- 'id': 'osm-tiles',
49
- 'type': 'raster',
50
- 'source': 'osm-tiles',
51
- 'minzoom': 0,
52
- 'maxzoom': 19
53
- }
54
- ]
55
- }
56
- });
57
-
58
- map.on('load', () => {
59
- //Create a new instance of the SVG manager.
60
- svgManager = new maplibregl.SvgManager(map);
61
-
62
- //Load an SVG templated icon into the map.
63
- svgManager.createFromTemplate('myTemplatedImage', 'car', 'DodgerBlue', '#fff').then(() => {
64
-
65
- //Add a source for thelines.
66
- map.addSource('lines', {
67
- 'type': 'geojson',
68
- 'data': {
69
- 'type': 'FeatureCollection',
70
- 'features': [
71
- {
72
- 'type': 'Feature',
73
- 'properties': {
74
- },
75
- 'geometry': {
76
- 'type': 'LineString',
77
- 'coordinates': [
78
- [-122.18822, 47.63208],
79
- [-122.18204, 47.63196],
80
- [-122.17243, 47.62976],
81
- [-122.16419, 47.63023],
82
- [-122.15852, 47.62942],
83
- [-122.15183, 47.62988],
84
- [-122.14256, 47.63451],
85
- [-122.13483, 47.64041],
86
- [-122.13466, 47.64422],
87
- [-122.13844, 47.65440],
88
- [-122.13277, 47.66515],
89
- [-122.12779, 47.66712],
90
- [-122.11595, 47.66712],
91
- [-122.11063, 47.66735],
92
- [-122.10668, 47.67035],
93
- [-122.10565, 47.67498]
94
- ]
95
- }
96
- }
97
- ]
98
- }
99
- });
100
-
101
- //Add a layer to display the lines.
102
- map.addLayer({
103
- 'id': 'lines',
104
- 'type': 'line',
105
- 'source': 'lines',
106
- 'paint': {
107
- 'line-width': 5,
108
- 'line-color': 'Blue'
109
- }
110
- });
111
-
112
- //Add a layer for symbols along the line.
113
- map.addLayer({
114
- 'id': 'line-symbols',
115
- 'type': 'symbol',
116
- 'source': 'lines',
117
- 'layout': {
118
- //Reference the templated icon.
119
- 'icon-image': 'myTemplatedImage',
120
- 'symbol-placement': 'line',
121
- 'symbol-spacing': 100,
122
- 'icon-rotate': 90
123
- }
124
- });
125
- });
126
- });
127
- </script>
128
- </body>
129
- </html>
@@ -1,96 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Load SVG from URL</title>
5
- <meta charset='utf-8'>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
8
- <script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
9
-
10
- <script src="../dist/maplibre-gl-svg.js"></script>
11
-
12
- <style>
13
- body { margin: 0; padding: 0; }
14
- html, body { height: 100%; }
15
- #map { position: relative; width:100%; height:100%; }
16
- fieldset { position: absolute; top: 10px; left: 10px; width: 300px;z-index: 1; background-color: white;}
17
- legend {background-color: white;border-radius: 5px;border:1px solid #000;}
18
- </style>
19
- </head>
20
- <body>
21
- <div id="map"></div>
22
-
23
- <fieldset>
24
- <legend>Load SVG from URL</legend>
25
- This sample shows how to load an SVG from a URL into the map and display it as a symbol.
26
- </fieldset>
27
-
28
- <script>
29
- var marker, svgManager;
30
-
31
- const map = new maplibregl.Map({
32
- container: 'map',
33
- style: {
34
- 'version': 8,
35
- 'sources': {
36
- 'osm-tiles': {
37
- 'type': 'raster',
38
- 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ],
39
- 'tileSize': 256,
40
- 'attribution': '&copy; <a href="https://www.openstreetmap.org/about" target="_blank">OpenStreetMap</a>'
41
- }
42
- },
43
- 'layers': [
44
- {
45
- 'id': 'osm-tiles',
46
- 'type': 'raster',
47
- 'source': 'osm-tiles',
48
- 'minzoom': 0,
49
- 'maxzoom': 19
50
- }
51
- ]
52
- },
53
- zoom: 2
54
- });
55
-
56
- map.on('load', () => {
57
- //Create a new instance of the SVG manager.
58
- svgManager = new maplibregl.SvgManager(map);
59
-
60
- //Load an SVG templated icon into the map.
61
- svgManager.add('myTemplatedImage', '../assets/Smiley_face_changed.svg').then(() => {
62
-
63
- //Optionally set the max width/height of the image.
64
- //svgManager.add('myTemplatedImage', '../assets/Smiley_face_changed.svg', 30, 30).then(() => {
65
-
66
- //Add a layer to display a filled polygon.
67
- map.addLayer({
68
- 'id': 'symbol-layer',
69
- 'type': 'symbol',
70
- 'source': {
71
- 'type': 'geojson',
72
- 'data': {
73
- 'type': 'FeatureCollection',
74
- 'features': [
75
- {
76
- 'type': 'Feature',
77
- 'properties': {
78
- },
79
- 'geometry': {
80
- 'type': 'Point',
81
- 'coordinates': [0,0]
82
- }
83
- }
84
- ]
85
- }
86
- },
87
- 'layout': {
88
- //Reference the templated icon.
89
- 'icon-image': 'myTemplatedImage'
90
- }
91
- });
92
- });
93
- });
94
- </script>
95
- </body>
96
- </html>