@defra/interactive-map 0.0.53-alpha → 0.0.55-alpha
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.
- package/assets/templates/add-polygons.njk +1 -1
- package/assets/templates/add-symbols.njk +4 -4
- package/assets/templates/draw-tools.njk +7 -7
- package/assets/templates/marker-panel.njk +5 -5
- package/assets/templates/place-marker.njk +8 -8
- package/assets/templates/search-control.njk +1 -1
- package/assets/templates/select-feature.njk +7 -7
- package/assets/templates/style-switcher.njk +4 -4
- package/assets/templates/toggle-marker-label.njk +3 -3
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/im-core.js.LICENSE.txt +0 -30
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.LICENSE.txt +0 -20
- package/docs/api/context.md +12 -0
- package/docs/api.md +14 -16
- package/docs/building-a-plugin.md +2 -2
- package/docs/examples/add-marker-with-panel.mdx +46 -44
- package/docs/examples/add-polygons.mdx +100 -98
- package/docs/examples/add-symbols.mdx +75 -73
- package/docs/examples/basic-map.mdx +16 -14
- package/docs/examples/button-map.mdx +16 -14
- package/docs/examples/draw-tools.mdx +119 -117
- package/docs/examples/place-marker.mdx +51 -49
- package/docs/examples/search-control.mdx +22 -20
- package/docs/examples/select-feature.mdx +107 -105
- package/docs/examples/style-switcher.mdx +47 -45
- package/docs/examples/toggle-marker-label.mdx +30 -28
- package/docs/getting-started.md +26 -24
- package/docs/plugins/datasets.md +2 -0
- package/docs/plugins/draw.md +10 -10
- package/docs/plugins/interact.md +9 -9
- package/docs/plugins/map-key.md +41 -0
- package/docs/plugins/plugin-descriptor.md +1 -1
- package/docs/plugins/search.md +3 -3
- package/docusaurus.config.cjs +23 -0
- package/package.json +3 -7
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +1 -1
- package/plugins/beta/draw-es/dist/esm/index.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/index.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/DrawMode.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/EditMode.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +1 -1
- package/plugins/beta/draw-ol/dist/esm/index.js +1 -1
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/esm/index.js +1 -1
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -1
- package/plugins/beta/frame/dist/umd/index.js +1 -1
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/esm/index.js +1 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/beta/map-styles/dist/umd/index.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +1 -1
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -1
- package/plugins/beta/scale-bar/dist/umd/index.js +1 -1
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/esm/index.js +1 -1
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -1
- package/plugins/beta/use-location/dist/umd/index.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/esm/index.js +1 -1
- package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
- package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +6 -6
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/maplibre/layerBuilders.js +1 -1
- package/plugins/datasets/src/adapters/maplibre/layerBuilders.test.js +3 -3
- package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.js +1 -3
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +0 -12
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +2 -2
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +1 -2
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +3 -3
- package/plugins/datasets/src/fetch/createDynamicSource.js +2 -2
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +2 -2
- package/plugins/datasets/src/initialise/defaults.js +12 -24
- package/plugins/datasets/src/initialise/defaults.test.js +25 -57
- package/plugins/datasets/src/initialise/initialiseDatasets.js +1 -4
- package/plugins/datasets/src/reducers/mappedDatasetsReducer.test.js +1 -1
- package/plugins/datasets/src/registry/dataset.js +21 -16
- package/plugins/datasets/src/registry/dataset.test.js +101 -11
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/adapters/maplibre/styles.js +3 -2
- package/plugins/draw/src/adapters/maplibre/styles.test.js +3 -3
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/map-key/dist/css/index.css +1 -1
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/esm/index.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/map-key/src/components/Key/Key.module.scss +144 -53
- package/plugins/map-key/src/components/Key/KeyGroupItem.jsx +34 -3
- package/plugins/map-key/src/components/Key/KeyGroupItem.test.jsx +44 -2
- package/plugins/map-key/src/components/Key/KeySvg.jsx +5 -5
- package/plugins/map-key/src/components/Key/KeySvg.test.jsx +4 -4
- package/plugins/map-key/src/components/Key/KeySvgRamp.jsx +35 -6
- package/plugins/map-key/src/components/Key/KeySvgRamp.test.jsx +56 -16
- package/plugins/map-key/src/components/Key/useRampOrientation.js +61 -0
- package/plugins/map-key/src/components/Key/useRampOrientation.test.jsx +155 -0
- package/plugins/map-key/src/index.js +34 -0
- package/plugins/map-key/src/utils/groupStyles.js +5 -2
- package/plugins/menu/dist/esm/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/esm/index.js +1 -1
- package/plugins/menu/dist/umd/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/umd/index.js +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/plugins/search/src/Search.jsx +0 -1
- package/plugins/search/src/components/Form/Form.jsx +3 -3
- package/plugins/search/src/components/Suggestions/Suggestions.jsx +2 -0
- package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +6 -0
- package/plugins/search/src/defaults.js +3 -0
- package/plugins/search/src/events/formHandlers.js +3 -9
- package/plugins/search/src/events/formHandlers.test.js +6 -9
- package/plugins/search/src/events/inputHandlers.js +8 -2
- package/plugins/search/src/events/inputHandlers.test.js +20 -0
- package/plugins/search/src/events/suggestionHandlers.js +3 -5
- package/plugins/search/src/events/suggestionHandlers.test.js +5 -8
- package/plugins/search/src/utils/showResult.js +9 -0
- package/plugins/search/src/utils/showResult.test.js +16 -0
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/esri/dist/esm/index.js +1 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +1 -1
- package/providers/beta/open-names/dist/esm/index.js +1 -1
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +1 -1
- package/providers/beta/open-names/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/esm/index.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/src/index.js +27 -4
- package/providers/beta/openlayers/src/index.test.js +47 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +3 -3
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-worker.js +2 -0
- package/providers/maplibre/dist/umd/im-maplibre-worker.js.LICENSE.txt +4 -0
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/index.js +41 -12
- package/providers/maplibre/src/index.test.js +43 -12
- package/providers/maplibre/src/utils/detectModuleWorker.js +25 -0
- package/providers/maplibre/src/utils/detectModuleWorker.test.js +40 -0
- package/providers/maplibre/src/utils/spatial.js +22 -12
- package/providers/maplibre/src/utils/spatial.test.js +6 -6
- package/providers/maplibre/src/utils/workerUrl.js +15 -0
- package/providers/maplibre/src/utils/workerUrl.test.js +14 -0
- package/rollup.esm.mjs +38 -1
- package/src/App/components/Hints/Hints.module.scss +1 -1
- package/src/App/components/Viewport/Viewport.jsx +6 -4
- package/src/App/components/Viewport/Viewport.test.jsx +18 -1
- package/src/App/hooks/useMapAnnouncements.js +7 -2
- package/src/App/hooks/useMapAnnouncements.test.js +13 -2
- package/src/App/hooks/useModalPanelBehaviour.js +3 -1
- package/src/App/initialiseApp.js +1 -1
- package/src/App/store/ServiceProvider.jsx +7 -1
- package/src/App/store/ServiceProvider.test.jsx +15 -0
- package/src/InteractiveMap/InteractiveMap.js +5 -4
- package/src/InteractiveMap/InteractiveMap.test.js +9 -2
- package/src/InteractiveMap/domStateManager.js +21 -1
- package/src/InteractiveMap/domStateManager.test.js +48 -1
- package/src/InteractiveMap/polyfills.js +4 -3
- package/src/InteractiveMap/polyfills.test.js +12 -0
- package/src/services/mapFocus.js +64 -0
- package/src/services/mapFocus.test.js +76 -0
- package/src/types.js +5 -7
- package/src/utils/detectInterfaceType.js +16 -5
- package/src/utils/detectInterfaceType.test.js +32 -0
- package/webpack.dev.mjs +2 -0
- package/webpack.umd.mjs +28 -7
|
@@ -123,111 +123,113 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
|
|
|
123
123
|
label: 'UMD',
|
|
124
124
|
language: 'html',
|
|
125
125
|
code: `
|
|
126
|
-
<script src="/your-assets-path/interactive-map/index.js"></script>
|
|
127
|
-
<script src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
128
|
-
<script src="/your-assets-path/datasets-plugin/index.js"></script>
|
|
129
|
-
<script src="/your-assets-path/map-key-plugin/index.js"></script>
|
|
126
|
+
<script defer src="/your-assets-path/interactive-map/index.js"></script>
|
|
127
|
+
<script defer src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
128
|
+
<script defer src="/your-assets-path/datasets-plugin/index.js"></script>
|
|
129
|
+
<script defer src="/your-assets-path/map-key-plugin/index.js"></script>
|
|
130
130
|
|
|
131
131
|
<script>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
type: 'Feature',
|
|
142
|
-
id: 2,
|
|
143
|
-
properties: { name: 'Lamb field', land_use: 'Arable' },
|
|
144
|
-
geometry: { type: 'Polygon', coordinates: [[[-2.4611682,54.5562375],[-2.4628580,54.5568161],[-2.4636841,54.5573753],[-2.4637793,54.5574398],[-2.4641401,54.5576751],[-2.4642567,54.5577999],[-2.4641307,54.5578823],[-2.4636841,54.5582502],[-2.4624221,54.5592884],[-2.4623376,54.5592534],[-2.4615370,54.5586429],[-2.4611869,54.5582852],[-2.4605258,54.5581071],[-2.4598472,54.5578186],[-2.4611682,54.5562375]]] }
|
|
145
|
-
}, {
|
|
146
|
-
type: 'Feature',
|
|
147
|
-
id: 3,
|
|
148
|
-
properties: { name: 'Small hay field', land_use: 'Arable' },
|
|
149
|
-
geometry: { type: 'Polygon', coordinates: [[[-2.4598472,54.5578186],[-2.4605258,54.5581067],[-2.4611869,54.5582852],[-2.4615376,54.5586433],[-2.4623108,54.5592332],[-2.4623376,54.5592534],[-2.4624221,54.5592884],[-2.4623108,54.5594120],[-2.4616731,54.5601189],[-2.4586053,54.5601189],[-2.4584410,54.5600299],[-2.4580038,54.5596574],[-2.4581815,54.5593953],[-2.4585778,54.5590702],[-2.4587287,54.5589353],[-2.4589198,54.5586736],[-2.4591116,54.5582136],[-2.4598472,54.5578186]]] }
|
|
150
|
-
}, {
|
|
151
|
-
type: 'Feature',
|
|
152
|
-
id: 4,
|
|
153
|
-
properties: { name: 'The pasture', land_use: 'Permanent grassland' },
|
|
154
|
-
geometry: { type: 'Polygon', coordinates: [[[-2.4633756,54.5612877],[-2.4613908,54.5604315],[-2.4624221,54.5592884],[-2.4641307,54.5578823],[-2.4642567,54.5577999],[-2.4653631,54.5591733],[-2.4659613,54.5597013],[-2.4633756,54.5612877]]] }
|
|
155
|
-
}, {
|
|
156
|
-
type: 'Feature',
|
|
157
|
-
id: 5,
|
|
158
|
-
properties: { name: 'Herdwick Croft', land_use: 'Arable' },
|
|
159
|
-
geometry: { type: 'Polygon', coordinates: [[[-2.4678040,54.5590679],[-2.4661879,54.5595952],[-2.4659613,54.5597013],[-2.4653638,54.5591737],[-2.4642567,54.5577999],[-2.4641401,54.5576751],[-2.4637793,54.5574398],[-2.4662369,54.5562822],[-2.4669282,54.5566975],[-2.4678040,54.5563320],[-2.4678040,54.5590679]]] }
|
|
160
|
-
}, {
|
|
161
|
-
type: 'Feature',
|
|
162
|
-
id: 6,
|
|
163
|
-
properties: { name: "Wainwright's Rest", land_use: 'Permanent grassland' },
|
|
164
|
-
geometry: { type: 'Polygon', coordinates: [[[-2.4669316,54.5603767],[-2.4676430,54.5613102],[-2.4673292,54.5614556],[-2.4671616,54.5617468],[-2.4658446,54.5625528],[-2.4651546,54.5621528],[-2.4639215,54.5633040],[-2.4633146,54.5633040],[-2.4628372,54.5630921],[-2.4631195,54.5628195],[-2.4643741,54.5618374],[-2.4665071,54.5604793],[-2.4667056,54.5604187],[-2.4669316,54.5603767]]] }
|
|
165
|
-
}, {
|
|
166
|
-
type: 'Feature',
|
|
167
|
-
id: 7,
|
|
168
|
-
properties: { name: 'Badger Sett Copse', land_use: 'Woodland' },
|
|
169
|
-
geometry: { type: 'Polygon', coordinates: [[[-2.4599129,54.5564203],[-2.4599773,54.5565478],[-2.4599773,54.5565852],[-2.4599344,54.5566256],[-2.4596876,54.5566069],[-2.4594945,54.5566132],[-2.4593657,54.5566505],[-2.4592584,54.5567158],[-2.4592048,54.5567780],[-2.4591780,54.5568496],[-2.4591887,54.5569616],[-2.4591297,54.5570829],[-2.4590009,54.5572726],[-2.4589419,54.5573162],[-2.4588561,54.5574686],[-2.4587435,54.5575588],[-2.4586684,54.5575837],[-2.4585879,54.5575962],[-2.4584001,54.5575837],[-2.4583304,54.5575899],[-2.4580836,54.5576397],[-2.4579817,54.5576895],[-2.4579227,54.5576988],[-2.4578154,54.5576988],[-2.4576384,54.5576739],[-2.4574614,54.5576739],[-2.4573044,54.5577050],[-2.4563093,54.5573092],[-2.4563871,54.5569849],[-2.4564891,54.5560664],[-2.4565601,54.5559039],[-2.4567747,54.5559412],[-2.4571985,54.5559817],[-2.4573219,54.5560097],[-2.4576116,54.5560936],[-2.4582446,54.5562181],[-2.4584913,54.5562959],[-2.4590331,54.5563705],[-2.4599129,54.5564203]]] }
|
|
170
|
-
}]
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const datasetsPlugin = defra.datasetsPlugin({
|
|
174
|
-
datasets: [{
|
|
175
|
-
id: 'field-parcels',
|
|
176
|
-
label: 'Field parcels',
|
|
177
|
-
geojson: geojson,
|
|
178
|
-
minZoom: 10,
|
|
179
|
-
maxZoom: 24,
|
|
180
|
-
showInKey: true,
|
|
181
|
-
showInMenu: true,
|
|
182
|
-
sublayers: [{
|
|
183
|
-
id: 'arable',
|
|
184
|
-
label: 'Arable',
|
|
185
|
-
filter: ['==', ['get', 'land_use'], 'Arable'],
|
|
186
|
-
style: {
|
|
187
|
-
stroke: '#573C34',
|
|
188
|
-
fillPattern: 'horizontal-hatch',
|
|
189
|
-
fillPatternForegroundColor: '#573C34',
|
|
190
|
-
fillPatternBackgroundColor: 'transparent'
|
|
191
|
-
}
|
|
132
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
133
|
+
// GeoJSON can also be loaded from a URL; use the tiles property for vector tile sources
|
|
134
|
+
const geojson = {
|
|
135
|
+
type: 'FeatureCollection',
|
|
136
|
+
features: [{
|
|
137
|
+
type: 'Feature',
|
|
138
|
+
id: 1,
|
|
139
|
+
properties: { name: 'Large meadow', land_use: 'Permanent grassland' },
|
|
140
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4691585,54.5552164],[-2.4692202,54.5553906],[-2.4690646,54.5554155],[-2.4690002,54.5555088],[-2.4690297,54.5556690],[-2.4690995,54.5557919],[-2.4669269,54.5566971],[-2.4662375,54.5562819],[-2.4637780,54.5574391],[-2.4628580,54.5568169],[-2.4607612,54.5560985],[-2.4608248,54.5560719],[-2.4611789,54.5558914],[-2.4613774,54.5558168],[-2.4615973,54.5557577],[-2.4617475,54.5557297],[-2.4618816,54.5556519],[-2.4620104,54.5556115],[-2.4624771,54.5555275],[-2.4627131,54.5555150],[-2.4628741,54.5554839],[-2.4630082,54.5554404],[-2.4632335,54.5553346],[-2.4633944,54.5552164],[-2.4634749,54.5551106],[-2.4635178,54.5550235],[-2.4635285,54.5548213],[-2.4635768,54.5546346],[-2.4635875,54.5544884],[-2.4636090,54.5544075],[-2.4636465,54.5543515],[-2.4636573,54.5542769],[-2.4636358,54.5541804],[-2.4637377,54.5540155],[-2.4639094,54.5538724],[-2.4643493,54.5535831],[-2.4645370,54.5535084],[-2.4647141,54.5534804],[-2.4648052,54.5534836],[-2.4648213,54.5535116],[-2.4648750,54.5535396],[-2.4650842,54.5535893],[-2.4652451,54.5536516],[-2.4652719,54.5536796],[-2.4653900,54.5537355],[-2.4655455,54.5537853],[-2.4658459,54.5539502],[-2.4663556,54.5542738],[-2.4668008,54.5545164],[-2.4668330,54.5545506],[-2.4668437,54.5546782],[-2.4668598,54.5547031],[-2.4670798,54.5548306],[-2.4671817,54.5549053],[-2.4674177,54.5549364],[-2.4677664,54.5550484],[-2.4681956,54.5551448],[-2.4684101,54.5551759],[-2.4691129,54.5552195],[-2.4691585,54.5552164]]] }
|
|
192
141
|
}, {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
stroke: '#005149',
|
|
198
|
-
fillPattern: 'diagonal-cross-hatch',
|
|
199
|
-
fillPatternForegroundColor: '#005149',
|
|
200
|
-
fillPatternBackgroundColor: 'transparent'
|
|
201
|
-
}
|
|
142
|
+
type: 'Feature',
|
|
143
|
+
id: 2,
|
|
144
|
+
properties: { name: 'Lamb field', land_use: 'Arable' },
|
|
145
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4611682,54.5562375],[-2.4628580,54.5568161],[-2.4636841,54.5573753],[-2.4637793,54.5574398],[-2.4641401,54.5576751],[-2.4642567,54.5577999],[-2.4641307,54.5578823],[-2.4636841,54.5582502],[-2.4624221,54.5592884],[-2.4623376,54.5592534],[-2.4615370,54.5586429],[-2.4611869,54.5582852],[-2.4605258,54.5581071],[-2.4598472,54.5578186],[-2.4611682,54.5562375]]] }
|
|
202
146
|
}, {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
147
|
+
type: 'Feature',
|
|
148
|
+
id: 3,
|
|
149
|
+
properties: { name: 'Small hay field', land_use: 'Arable' },
|
|
150
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4598472,54.5578186],[-2.4605258,54.5581067],[-2.4611869,54.5582852],[-2.4615376,54.5586433],[-2.4623108,54.5592332],[-2.4623376,54.5592534],[-2.4624221,54.5592884],[-2.4623108,54.5594120],[-2.4616731,54.5601189],[-2.4586053,54.5601189],[-2.4584410,54.5600299],[-2.4580038,54.5596574],[-2.4581815,54.5593953],[-2.4585778,54.5590702],[-2.4587287,54.5589353],[-2.4589198,54.5586736],[-2.4591116,54.5582136],[-2.4598472,54.5578186]]] }
|
|
151
|
+
}, {
|
|
152
|
+
type: 'Feature',
|
|
153
|
+
id: 4,
|
|
154
|
+
properties: { name: 'The pasture', land_use: 'Permanent grassland' },
|
|
155
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4633756,54.5612877],[-2.4613908,54.5604315],[-2.4624221,54.5592884],[-2.4641307,54.5578823],[-2.4642567,54.5577999],[-2.4653631,54.5591733],[-2.4659613,54.5597013],[-2.4633756,54.5612877]]] }
|
|
156
|
+
}, {
|
|
157
|
+
type: 'Feature',
|
|
158
|
+
id: 5,
|
|
159
|
+
properties: { name: 'Herdwick Croft', land_use: 'Arable' },
|
|
160
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4678040,54.5590679],[-2.4661879,54.5595952],[-2.4659613,54.5597013],[-2.4653638,54.5591737],[-2.4642567,54.5577999],[-2.4641401,54.5576751],[-2.4637793,54.5574398],[-2.4662369,54.5562822],[-2.4669282,54.5566975],[-2.4678040,54.5563320],[-2.4678040,54.5590679]]] }
|
|
161
|
+
}, {
|
|
162
|
+
type: 'Feature',
|
|
163
|
+
id: 6,
|
|
164
|
+
properties: { name: "Wainwright's Rest", land_use: 'Permanent grassland' },
|
|
165
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4669316,54.5603767],[-2.4676430,54.5613102],[-2.4673292,54.5614556],[-2.4671616,54.5617468],[-2.4658446,54.5625528],[-2.4651546,54.5621528],[-2.4639215,54.5633040],[-2.4633146,54.5633040],[-2.4628372,54.5630921],[-2.4631195,54.5628195],[-2.4643741,54.5618374],[-2.4665071,54.5604793],[-2.4667056,54.5604187],[-2.4669316,54.5603767]]] }
|
|
166
|
+
}, {
|
|
167
|
+
type: 'Feature',
|
|
168
|
+
id: 7,
|
|
169
|
+
properties: { name: 'Badger Sett Copse', land_use: 'Woodland' },
|
|
170
|
+
geometry: { type: 'Polygon', coordinates: [[[-2.4599129,54.5564203],[-2.4599773,54.5565478],[-2.4599773,54.5565852],[-2.4599344,54.5566256],[-2.4596876,54.5566069],[-2.4594945,54.5566132],[-2.4593657,54.5566505],[-2.4592584,54.5567158],[-2.4592048,54.5567780],[-2.4591780,54.5568496],[-2.4591887,54.5569616],[-2.4591297,54.5570829],[-2.4590009,54.5572726],[-2.4589419,54.5573162],[-2.4588561,54.5574686],[-2.4587435,54.5575588],[-2.4586684,54.5575837],[-2.4585879,54.5575962],[-2.4584001,54.5575837],[-2.4583304,54.5575899],[-2.4580836,54.5576397],[-2.4579817,54.5576895],[-2.4579227,54.5576988],[-2.4578154,54.5576988],[-2.4576384,54.5576739],[-2.4574614,54.5576739],[-2.4573044,54.5577050],[-2.4563093,54.5573092],[-2.4563871,54.5569849],[-2.4564891,54.5560664],[-2.4565601,54.5559039],[-2.4567747,54.5559412],[-2.4571985,54.5559817],[-2.4573219,54.5560097],[-2.4576116,54.5560936],[-2.4582446,54.5562181],[-2.4584913,54.5562959],[-2.4590331,54.5563705],[-2.4599129,54.5564203]]] }
|
|
212
171
|
}]
|
|
213
|
-
}
|
|
214
|
-
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const datasetsPlugin = defra.datasetsPlugin({
|
|
175
|
+
datasets: [{
|
|
176
|
+
id: 'field-parcels',
|
|
177
|
+
label: 'Field parcels',
|
|
178
|
+
geojson: geojson,
|
|
179
|
+
minZoom: 10,
|
|
180
|
+
maxZoom: 24,
|
|
181
|
+
showInKey: true,
|
|
182
|
+
showInMenu: true,
|
|
183
|
+
sublayers: [{
|
|
184
|
+
id: 'arable',
|
|
185
|
+
label: 'Arable',
|
|
186
|
+
filter: ['==', ['get', 'land_use'], 'Arable'],
|
|
187
|
+
style: {
|
|
188
|
+
stroke: '#573C34',
|
|
189
|
+
fillPattern: 'horizontal-hatch',
|
|
190
|
+
fillPatternForegroundColor: '#573C34',
|
|
191
|
+
fillPatternBackgroundColor: 'transparent'
|
|
192
|
+
}
|
|
193
|
+
}, {
|
|
194
|
+
id: 'permanent-grassland',
|
|
195
|
+
label: 'Permanent grassland',
|
|
196
|
+
filter: ['==', ['get', 'land_use'], 'Permanent grassland'],
|
|
197
|
+
style: {
|
|
198
|
+
stroke: '#005149',
|
|
199
|
+
fillPattern: 'diagonal-cross-hatch',
|
|
200
|
+
fillPatternForegroundColor: '#005149',
|
|
201
|
+
fillPatternBackgroundColor: 'transparent'
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
id: 'woodland',
|
|
205
|
+
label: 'Woodland',
|
|
206
|
+
filter: ['==', ['get', 'land_use'], 'Woodland'],
|
|
207
|
+
style: {
|
|
208
|
+
stroke: '#1E5020',
|
|
209
|
+
fillPattern: 'dot',
|
|
210
|
+
fillPatternForegroundColor: '#1E5020',
|
|
211
|
+
fillPatternBackgroundColor: 'transparent'
|
|
212
|
+
}
|
|
213
|
+
}]
|
|
214
|
+
}]
|
|
215
|
+
})
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
const mapKeyPlugin = defra.mapKeyPlugin()
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
219
|
+
new defra.InteractiveMap('my-map', {
|
|
220
|
+
behaviour: 'inline',
|
|
221
|
+
mapProvider: defra.maplibreProvider(),
|
|
222
|
+
mapStyle: {
|
|
223
|
+
url: 'https://your-tile-url/style.json',
|
|
224
|
+
logo: '/path/to/logo.svg',
|
|
225
|
+
logoAltText: 'Your logo alt text',
|
|
226
|
+
attribution: 'Your tile attribution'
|
|
227
|
+
},
|
|
228
|
+
center: [-2.464, 54.558],
|
|
229
|
+
zoom: 14,
|
|
230
|
+
containerHeight: '516px',
|
|
231
|
+
plugins: [datasetsPlugin, mapKeyPlugin]
|
|
232
|
+
})
|
|
231
233
|
})
|
|
232
234
|
</script>
|
|
233
235
|
`
|
|
@@ -99,87 +99,89 @@ Use the datasets plugin to overlay GeoJSON data on your map. Each dataset can co
|
|
|
99
99
|
label: 'UMD',
|
|
100
100
|
language: 'html',
|
|
101
101
|
code: `
|
|
102
|
-
<script src="/your-assets-path/interactive-map/index.js"></script>
|
|
103
|
-
<script src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
104
|
-
<script src="/your-assets-path/datasets-plugin/index.js"></script>
|
|
105
|
-
<script src="/your-assets-path/map-key-plugin/index.js"></script>
|
|
102
|
+
<script defer src="/your-assets-path/interactive-map/index.js"></script>
|
|
103
|
+
<script defer src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
104
|
+
<script defer src="/your-assets-path/datasets-plugin/index.js"></script>
|
|
105
|
+
<script defer src="/your-assets-path/map-key-plugin/index.js"></script>
|
|
106
106
|
|
|
107
107
|
<script>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// GeoJSON can also be loaded from a URL; use the tiles property for vector tile sources
|
|
111
|
-
const geojson = {
|
|
112
|
-
type: 'FeatureCollection',
|
|
113
|
-
features: [{
|
|
114
|
-
type: 'Feature',
|
|
115
|
-
properties: { category: 'prehistoric', name: 'Prehistoric feature' },
|
|
116
|
-
geometry: { type: 'Point', coordinates: [-2.4615, 54.5616] }
|
|
117
|
-
}, {
|
|
118
|
-
type: 'Feature',
|
|
119
|
-
properties: { category: 'roman', name: 'Roman feature' },
|
|
120
|
-
geometry: { type: 'Point', coordinates: [-2.4628, 54.5541] }
|
|
121
|
-
}, {
|
|
122
|
-
type: 'Feature',
|
|
123
|
-
properties: { category: 'medieval', name: 'Medieval feature' },
|
|
124
|
-
geometry: { type: 'Point', coordinates: [-2.4578, 54.5569] }
|
|
125
|
-
}]
|
|
126
|
-
}
|
|
108
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
109
|
+
const symbolGraphic = 'M3 15H1V1h2v2h2V1h2v5h2V4h2v2h2V4h2v11H6V9H3v6z'
|
|
127
110
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
showInKey: true,
|
|
136
|
-
showInMenu: true,
|
|
137
|
-
sublayers: [{
|
|
138
|
-
id: 'prehistoric',
|
|
139
|
-
label: 'Prehistoric',
|
|
140
|
-
filter: ['in', ['get', 'category'], 'prehistoric'],
|
|
141
|
-
style: {
|
|
142
|
-
symbol: 'square',
|
|
143
|
-
symbolGraphic,
|
|
144
|
-
symbolBackgroundColor: '#00897B'
|
|
145
|
-
}
|
|
111
|
+
// GeoJSON can also be loaded from a URL; use the tiles property for vector tile sources
|
|
112
|
+
const geojson = {
|
|
113
|
+
type: 'FeatureCollection',
|
|
114
|
+
features: [{
|
|
115
|
+
type: 'Feature',
|
|
116
|
+
properties: { category: 'prehistoric', name: 'Prehistoric feature' },
|
|
117
|
+
geometry: { type: 'Point', coordinates: [-2.4615, 54.5616] }
|
|
146
118
|
}, {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
style: {
|
|
151
|
-
symbol: 'square',
|
|
152
|
-
symbolGraphic,
|
|
153
|
-
symbolBackgroundColor: '#ca3535'
|
|
154
|
-
}
|
|
119
|
+
type: 'Feature',
|
|
120
|
+
properties: { category: 'roman', name: 'Roman feature' },
|
|
121
|
+
geometry: { type: 'Point', coordinates: [-2.4628, 54.5541] }
|
|
155
122
|
}, {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
style: {
|
|
160
|
-
symbol: 'square',
|
|
161
|
-
symbolGraphic,
|
|
162
|
-
symbolBackgroundColor: '#1565C0'
|
|
163
|
-
}
|
|
123
|
+
type: 'Feature',
|
|
124
|
+
properties: { category: 'medieval', name: 'Medieval feature' },
|
|
125
|
+
geometry: { type: 'Point', coordinates: [-2.4578, 54.5569] }
|
|
164
126
|
}]
|
|
165
|
-
}
|
|
166
|
-
})
|
|
127
|
+
}
|
|
167
128
|
|
|
168
|
-
|
|
129
|
+
const datasetsPlugin = defra.datasetsPlugin({
|
|
130
|
+
datasets: [{
|
|
131
|
+
id: 'historic-monuments',
|
|
132
|
+
label: 'Historic monuments',
|
|
133
|
+
geojson: geojson,
|
|
134
|
+
minZoom: 10,
|
|
135
|
+
maxZoom: 24,
|
|
136
|
+
showInKey: true,
|
|
137
|
+
showInMenu: true,
|
|
138
|
+
sublayers: [{
|
|
139
|
+
id: 'prehistoric',
|
|
140
|
+
label: 'Prehistoric',
|
|
141
|
+
filter: ['in', ['get', 'category'], 'prehistoric'],
|
|
142
|
+
style: {
|
|
143
|
+
symbol: 'square',
|
|
144
|
+
symbolGraphic: symbolGraphic,
|
|
145
|
+
symbolBackgroundColor: '#00897B'
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
id: 'roman',
|
|
149
|
+
label: 'Roman',
|
|
150
|
+
filter: ['in', ['get', 'category'], 'roman'],
|
|
151
|
+
style: {
|
|
152
|
+
symbol: 'square',
|
|
153
|
+
symbolGraphic: symbolGraphic,
|
|
154
|
+
symbolBackgroundColor: '#ca3535'
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
id: 'medieval',
|
|
158
|
+
label: 'Medieval',
|
|
159
|
+
filter: ['in', ['get', 'category'], 'medieval'],
|
|
160
|
+
style: {
|
|
161
|
+
symbol: 'square',
|
|
162
|
+
symbolGraphic: symbolGraphic,
|
|
163
|
+
symbolBackgroundColor: '#1565C0'
|
|
164
|
+
}
|
|
165
|
+
}]
|
|
166
|
+
}]
|
|
167
|
+
})
|
|
169
168
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
const mapKeyPlugin = defra.mapKeyPlugin()
|
|
170
|
+
|
|
171
|
+
new defra.InteractiveMap('my-map', {
|
|
172
|
+
behaviour: 'inline',
|
|
173
|
+
mapProvider: defra.maplibreProvider(),
|
|
174
|
+
mapStyle: {
|
|
175
|
+
url: 'https://your-tile-url/style.json',
|
|
176
|
+
logo: '/path/to/logo.svg',
|
|
177
|
+
logoAltText: 'Your logo alt text',
|
|
178
|
+
attribution: 'Your tile attribution'
|
|
179
|
+
},
|
|
180
|
+
center: [-2.4608, 54.5574],
|
|
181
|
+
zoom: 14,
|
|
182
|
+
containerHeight: '516px',
|
|
183
|
+
plugins: [datasetsPlugin, mapKeyPlugin]
|
|
184
|
+
})
|
|
183
185
|
})
|
|
184
186
|
</script>
|
|
185
187
|
`
|
|
@@ -34,22 +34,24 @@ Embed an interactive map directly on the page, allowing users to explore and int
|
|
|
34
34
|
label: 'UMD',
|
|
35
35
|
language: 'html',
|
|
36
36
|
code: `
|
|
37
|
-
<script src="/your-assets-path/interactive-map/index.js"></script>
|
|
38
|
-
<script src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
37
|
+
<script defer src="/your-assets-path/interactive-map/index.js"></script>
|
|
38
|
+
<script defer src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
39
39
|
|
|
40
40
|
<script>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
42
|
+
new defra.InteractiveMap('my-map', {
|
|
43
|
+
behaviour: 'inline',
|
|
44
|
+
mapProvider: defra.maplibreProvider(),
|
|
45
|
+
mapStyle: {
|
|
46
|
+
url: 'https://your-tile-url/style.json',
|
|
47
|
+
logo: '/path/to/logo.svg',
|
|
48
|
+
logoAltText: 'Your logo alt text',
|
|
49
|
+
attribution: 'Your tile attribution'
|
|
50
|
+
},
|
|
51
|
+
center: [-1.6, 53.1],
|
|
52
|
+
zoom: 6,
|
|
53
|
+
containerHeight: '516px'
|
|
54
|
+
})
|
|
53
55
|
})
|
|
54
56
|
</script>
|
|
55
57
|
`
|
|
@@ -34,22 +34,24 @@ Trigger the map to show on button press, allowing users to access the map when n
|
|
|
34
34
|
label: 'UMD',
|
|
35
35
|
language: 'html',
|
|
36
36
|
code: `
|
|
37
|
-
<script src="/your-assets-path/interactive-map/index.js"></script>
|
|
38
|
-
<script src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
37
|
+
<script defer src="/your-assets-path/interactive-map/index.js"></script>
|
|
38
|
+
<script defer src="/your-assets-path/maplibre-provider/index.js"></script>
|
|
39
39
|
|
|
40
40
|
<script>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
42
|
+
new defra.InteractiveMap('my-map', {
|
|
43
|
+
behaviour: 'buttonFirst',
|
|
44
|
+
mapProvider: defra.maplibreProvider(),
|
|
45
|
+
mapStyle: {
|
|
46
|
+
url: 'https://your-tile-url/style.json',
|
|
47
|
+
logo: '/path/to/logo.svg',
|
|
48
|
+
logoAltText: 'Your logo alt text',
|
|
49
|
+
attribution: 'Your tile attribution'
|
|
50
|
+
},
|
|
51
|
+
center: [-1.6, 53.1],
|
|
52
|
+
zoom: 6,
|
|
53
|
+
hasExitButton: true
|
|
54
|
+
})
|
|
53
55
|
})
|
|
54
56
|
</script>
|
|
55
57
|
`
|