-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlocation-map.js
More file actions
774 lines (659 loc) · 22.1 KB
/
location-map.js
File metadata and controls
774 lines (659 loc) · 22.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
// @ts-expect-error - no types
import OsGridRef, { LatLon } from 'geodesy/osgridref.js'
/**
* Converts lat long to easting and northing
* @param {object} param
* @param {number} param.lat
* @param {number} param.long
* @returns {{ easting: number, northing: number }}
*/
function latLongToEastingNorthing({ lat, long }) {
const point = new LatLon(lat, long)
return point.toOsGrid()
}
/**
* Converts easting and northing to lat long
* @param {object} param
* @param {number} param.easting
* @param {number} param.northing
* @returns {{ lat: number, long: number }}
*/
function eastingNorthingToLatLong({ easting, northing }) {
const point = new OsGridRef(easting, northing)
const latLong = point.toLatLon()
return { lat: latLong.latitude, long: latLong.longitude }
}
/**
* Converts lat long to an ordnance survey grid reference
* @param {object} param
* @param {number} param.lat
* @param {number} param.long
* @returns {string}
*/
function latLongToOsGridRef({ lat, long }) {
const point = new LatLon(lat, long)
return point.toOsGrid().toString()
}
/**
* Converts an ordnance survey grid reference to lat long
* @param {string} osGridRef
* @returns {{ lat: number, long: number }}
*/
function osGridRefToLatLong(osGridRef) {
const point = OsGridRef.parse(osGridRef)
const latLong = point.toLatLon()
return { lat: latLong.latitude, long: latLong.longitude }
}
// Center of UK
const DEFAULT_LAT = 53.825564
const DEFAULT_LONG = -2.421975
/** @type {InteractiveMapInitConfig} */
const defaultConfig = {
zoom: '6',
center: [DEFAULT_LONG, DEFAULT_LAT]
}
const COMPANY_SYMBOL_CODE = 169
const LOCATION_FIELD_SELECTOR = 'input.govuk-input'
const EVENTS = {
interactMarkerChange: 'interact:markerchange'
}
const defaultData = {
VTS_OUTDOOR_URL: '/api/maps/vts/OS_VTS_3857_Outdoor.json',
VTS_DARK_URL: '/api/maps/vts/OS_VTS_3857_Dark.json',
VTS_BLACK_AND_WHITE_URL: '/api/maps/vts/OS_VTS_3857_Black_and_White.json'
}
/**
* Make a form submit handler that only allows submissions from allowed buttons
* @param {HTMLButtonElement[]} buttons - the form buttons to allow submissions
*/
export function formSubmitFactory(buttons) {
/**
* The submit handler
* @param {SubmitEvent} e
*/
const onFormSubmit = function (e) {
if (
!(e.submitter instanceof HTMLButtonElement) ||
!buttons.includes(e.submitter)
) {
e.preventDefault()
}
}
return onFormSubmit
}
/**
* Initialise location maps
* @param {Partial<MapsEnvironmentConfig>} config - the map configuration
*/
export function initMaps(config = {}) {
const {
assetPath = '/assets',
apiPath = '/form/api',
data = defaultData
} = config
const locations = document.querySelectorAll('.app-location-field')
// TODO: Fix this in `interactive-map`
// If there are location components on the page fix up the main form submit
// handler so it doesn't fire when using the integrated map search feature
if (locations.length) {
const form = document.querySelector('form')
if (form === null) {
return
}
const buttons = Array.from(form.querySelectorAll('button'))
form.addEventListener('submit', formSubmitFactory(buttons), false)
}
locations.forEach((location, index) => {
processLocation({ assetPath, apiPath, data }, location, index)
})
}
/**
* OS API request proxy factory
* @param {string} apiPath - the root API path
*/
export function makeTileRequestTransformer(apiPath) {
/**
* Proxy OS API requests via our server
* @param {string} url - the request URL
* @param {string} resourceType - the resource type
*/
return function transformTileRequest(url, resourceType) {
if (url.startsWith('https://api.os.uk')) {
if (resourceType === 'Tile') {
return {
url: url.replace(
'https://api.os.uk/maps/vector/v1/vts',
`${window.location.origin}${apiPath}`
),
headers: {}
}
}
if (resourceType !== 'Style') {
return {
url: `${apiPath}/map-proxy?url=${encodeURIComponent(url)}`,
headers: {}
}
}
}
const spritesPath =
'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main'
// Proxy sprite requests
if (url.startsWith(spritesPath)) {
const path = url.substring(spritesPath.length)
return {
url: `${apiPath}/maps/vts${path}`,
headers: {}
}
}
return { url, headers: {} }
}
}
/**
* Processes a location field to add map capability
* @param {MapsEnvironmentConfig} config - the location field element
* @param {Element} location - the location field element
* @param {*} index - the 0-based index
*/
function processLocation(config, location, index) {
if (!(location instanceof HTMLDivElement)) {
return
}
const locationInputs = location.querySelector('.app-location-field-inputs')
if (!(locationInputs instanceof HTMLDivElement)) {
return
}
const locationType = location.dataset.locationtype
// Check for support
const supportedLocations = [
'latlongfield',
'eastingnorthingfield',
'osgridreffield'
]
if (!locationType || !supportedLocations.includes(locationType)) {
return
}
const mapContainer = document.createElement('div')
const mapId = `map_${index}`
mapContainer.setAttribute('id', mapId)
mapContainer.setAttribute('class', 'map-container')
const initConfig = getInitMapConfig(location) ?? defaultConfig
locationInputs.after(mapContainer)
const { map, interactPlugin } = createMap(mapId, initConfig, config)
map.on(
'map:ready',
/**
* Callback function which fires when the map is ready
* @param {object} e - the event
* @param {MapLibreMap} e.map - the map provider instance
*/
function onMapReady(e) {
switch (locationType) {
case 'latlongfield':
bindLatLongField(location, map, e.map)
break
case 'eastingnorthingfield':
bindEastingNorthingField(location, map, e.map)
break
case 'osgridreffield':
bindOsGridRefField(location, map, e.map)
break
default:
throw new Error('Not implemented')
}
// Add info panel
map.addPanel('info', {
showLabel: true,
label: 'How to use the map',
mobile: {
slot: 'bottom',
initiallyOpen: true,
dismissable: true,
modal: false
},
tablet: {
slot: 'bottom',
initiallyOpen: true,
dismissable: true,
modal: false
},
desktop: {
slot: 'bottom',
initiallyOpen: true,
dismissable: true,
modal: false
},
html: 'If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter.'
})
// Enable the interact plugin
interactPlugin.enable()
}
)
}
/**
* Create a Defra map instance
* @param {string} mapId - the map id
* @param {InteractiveMapInitConfig} initConfig - the map initial configuration
* @param {MapsEnvironmentConfig} mapsConfig - the map environment params
*/
function createMap(mapId, initConfig, mapsConfig) {
const { assetPath, apiPath, data = defaultData } = mapsConfig
const logoAltText = 'Ordnance survey logo'
// @ts-expect-error - Defra namespace currently comes from UMD support files
const defra = window.defra
const interactPlugin = defra.interactPlugin({
dataLayers: [],
markerColor: { outdoor: '#ff0000', dark: '#00ff00' },
interactionMode: 'marker',
multiSelect: false
})
/** @type {InteractiveMap} */
const map = new defra.InteractiveMap(mapId, {
...initConfig,
mapProvider: defra.maplibreProvider(),
reverseGeocodeProvider: defra.openNamesProvider({
url: `${apiPath}/reverse-geocode-proxy?easting={easting}&northing={northing}`
}),
behaviour: 'inline',
minZoom: 6,
maxZoom: 18,
containerHeight: '400px',
enableZoomControls: true,
transformRequest: makeTileRequestTransformer(apiPath),
plugins: [
defra.mapStylesPlugin({
mapStyles: [
{
id: 'outdoor',
label: 'Outdoor',
url: data.VTS_OUTDOOR_URL,
thumbnail: `${assetPath}/interactive-map/assets/images/outdoor-map-thumb.jpg`,
logo: `${assetPath}/interactive-map/assets/images/os-logo.svg`,
logoAltText,
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`,
backgroundColor: '#f5f5f0'
},
{
id: 'dark',
label: 'Dark',
url: data.VTS_DARK_URL,
mapColorScheme: 'dark',
appColorScheme: 'dark',
thumbnail: `${assetPath}/interactive-map/assets/images/dark-map-thumb.jpg`,
logo: `${assetPath}/interactive-map/assets/images/os-logo-white.svg`,
logoAltText,
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
},
{
id: 'black-and-white',
label: 'Black/White',
url: data.VTS_BLACK_AND_WHITE_URL,
thumbnail: `${assetPath}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,
logo: `${assetPath}/interactive-map/assets/images/os-logo-black.svg`,
logoAltText,
attribution: `Contains OS data ${String.fromCodePoint(COMPANY_SYMBOL_CODE)} Crown copyright and database rights ${new Date().getFullYear()}`
}
]
}),
interactPlugin,
defra.searchPlugin({
osNamesURL: `${apiPath}/geocode-proxy?query={query}`,
width: '300px',
showMarker: false
}),
defra.scaleBarPlugin({
units: 'metric'
})
]
})
return { map, interactPlugin }
}
/**
* Gets initial map config for a location field
* @param {HTMLDivElement} locationField - the location field element
*/
function getInitMapConfig(locationField) {
const locationType = locationField.dataset.locationtype
switch (locationType) {
case 'latlongfield':
return getInitLatLongMapConfig(locationField)
case 'eastingnorthingfield':
return getInitEastingNorthingMapConfig(locationField)
case 'osgridreffield':
return getInitOsGridRefMapConfig(locationField)
default:
throw new Error('Not implemented')
}
}
/**
* Validates lat and long is numeric and within UK bounds
* @param {string} strLat - the latitude string
* @param {string} strLong - the longitude string
* @returns {{ valid: false } | { valid: true, value: { lat: number, long: number } }}
*/
function validateLatLong(strLat, strLong) {
const lat = strLat.trim() && Number(strLat.trim())
const long = strLong.trim() && Number(strLong.trim())
if (!lat || !long) {
return { valid: false }
}
const latMin = 49.85
const latMax = 60.859
const longMin = -13.687
const longMax = 1.767
const latInBounds = lat >= latMin && lat <= latMax
const longInBounds = long >= longMin && long <= longMax
if (!latInBounds || !longInBounds) {
return { valid: false }
}
return { valid: true, value: { lat, long } }
}
/**
* Validates easting and northing is numeric and within UK bounds
* @param {string} strEasting - the easting string
* @param {string} strNorthing - the northing string
* @returns {{ valid: false } | { valid: true, value: { easting: number, northing: number } }}
*/
function validateEastingNorthing(strEasting, strNorthing) {
const easting = strEasting.trim() && Number(strEasting.trim())
const northing = strNorthing.trim() && Number(strNorthing.trim())
if (!easting || !northing) {
return { valid: false }
}
const eastingMin = 0
const eastingMax = 700000
const northingMin = 0
const northingMax = 1300000
const latInBounds = easting >= eastingMin && easting <= eastingMax
const longInBounds = northing >= northingMin && northing <= northingMax
if (!latInBounds || !longInBounds) {
return { valid: false }
}
return { valid: true, value: { easting, northing } }
}
/**
* Validates OS grid reference is correct
* @param {string} osGridRef - the OsGridRef
* @returns {{ valid: false } | { valid: true, value: string }}
*/
function validateOsGridRef(osGridRef) {
if (!osGridRef) {
return { valid: false }
}
const pattern =
/^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\s?(([0-9]{3})\s?([0-9]{3})|([0-9]{4})\s?([0-9]{4})|([0-9]{5})\s?([0-9]{5}))$/
const match = pattern.exec(osGridRef)
if (match === null) {
return { valid: false }
}
return { valid: true, value: match[0] }
}
/**
* Gets the inputs for a latlong location field
* @param {HTMLDivElement} locationField - the latlong location field element
*/
function getLatLongInputs(locationField) {
const inputs = locationField.querySelectorAll(LOCATION_FIELD_SELECTOR)
if (inputs.length !== 2) {
throw new Error('Expected 2 inputs for lat and long')
}
const latInput = /** @type {HTMLInputElement} */ (inputs[0])
const longInput = /** @type {HTMLInputElement} */ (inputs[1])
return { latInput, longInput }
}
/**
* Gets the inputs for a easting/northing location field
* @param {HTMLDivElement} locationField - the eastingnorthing location field element
*/
function getEastingNorthingInputs(locationField) {
const inputs = locationField.querySelectorAll(LOCATION_FIELD_SELECTOR)
if (inputs.length !== 2) {
throw new Error('Expected 2 inputs for easting and northing')
}
const eastingInput = /** @type {HTMLInputElement} */ (inputs[0])
const northingInput = /** @type {HTMLInputElement} */ (inputs[1])
return { eastingInput, northingInput }
}
/**
* Gets the input for a OS grid reference location field
* @param {HTMLDivElement} locationField - the osgridref location field element
*/
function getOsGridRefInput(locationField) {
const input = locationField.querySelector(LOCATION_FIELD_SELECTOR)
if (input === null) {
throw new Error('Expected 1 input for osgridref')
}
return /** @type {HTMLInputElement} */ (input)
}
/**
* Get the initial map config for a center point
* @param {MapCenter} center - the point
*/
function getInitMapCenterConfig(center) {
return {
zoom: '16',
center,
markers: [
{
id: 'location',
coords: center
}
]
}
}
/**
* Gets initial map config for a latlong location field
* @param {HTMLDivElement} locationField - the latlong location field element
* @returns {InteractiveMapInitConfig | undefined}
*/
function getInitLatLongMapConfig(locationField) {
const { latInput, longInput } = getLatLongInputs(locationField)
const result = validateLatLong(latInput.value, longInput.value)
if (!result.valid) {
return undefined
}
/** @type {MapCenter} */
const center = [result.value.long, result.value.lat]
return getInitMapCenterConfig(center)
}
/**
* Gets initial map config for a easting/northing location field
* @param {HTMLDivElement} locationField - the eastingnorthing location field element
* @returns {InteractiveMapInitConfig | undefined}
*/
function getInitEastingNorthingMapConfig(locationField) {
const { eastingInput, northingInput } =
getEastingNorthingInputs(locationField)
const result = validateEastingNorthing(
eastingInput.value,
northingInput.value
)
if (!result.valid) {
return undefined
}
const latlong = eastingNorthingToLatLong(result.value)
/** @type {MapCenter} */
const center = [latlong.long, latlong.lat]
return getInitMapCenterConfig(center)
}
/**
* Gets initial map config for an OS grid reference location field
* @param {HTMLDivElement} locationField - the osgridref location field element
* @returns {InteractiveMapInitConfig | undefined}
*/
function getInitOsGridRefMapConfig(locationField) {
const osGridRefInput = getOsGridRefInput(locationField)
const result = validateOsGridRef(osGridRefInput.value)
if (!result.valid) {
return undefined
}
const latlong = osGridRefToLatLong(result.value)
/** @type {MapCenter} */
const center = [latlong.long, latlong.lat]
return getInitMapCenterConfig(center)
}
/**
* Bind a latlong field to the map
* @param {HTMLDivElement} locationField - the latlong location field
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
*/
function bindLatLongField(locationField, map, mapProvider) {
const { latInput, longInput } = getLatLongInputs(locationField)
map.on(
EVENTS.interactMarkerChange,
/**
* Callback function which fires when the map marker changes
* @param {object} e - the event
* @param {[number, number]} e.coords - the map marker coordinates
*/
function onInteractMarkerChange(e) {
const maxPrecision = 7
latInput.value = e.coords[1].toFixed(maxPrecision)
longInput.value = e.coords[0].toFixed(maxPrecision)
}
)
/**
* Lat & long input change event listener
* Update the map view location when the inputs are changed
*/
function onUpdateInputs() {
const result = validateLatLong(latInput.value, longInput.value)
if (result.valid) {
/** @type {MapCenter} */
const center = [result.value.long, result.value.lat]
centerMap(map, mapProvider, center)
}
}
latInput.addEventListener('change', onUpdateInputs, false)
longInput.addEventListener('change', onUpdateInputs, false)
}
/**
* Bind an eastingnorthing field to the map
* @param {HTMLDivElement} locationField - the eastingnorthing location field
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
*/
function bindEastingNorthingField(locationField, map, mapProvider) {
const { eastingInput, northingInput } =
getEastingNorthingInputs(locationField)
map.on(
EVENTS.interactMarkerChange,
/**
* Callback function which fires when the map marker changes
* @param {object} e - the event
* @param {[number, number]} e.coords - the map marker coordinates
*/
function onInteractMarkerChange(e) {
const maxPrecision = 0
const point = latLongToEastingNorthing({
lat: e.coords[1],
long: e.coords[0]
})
eastingInput.value = point.easting.toFixed(maxPrecision)
northingInput.value = point.northing.toFixed(maxPrecision)
}
)
/**
* Easting & northing input change event listener
* Update the map view location when the inputs are changed
*/
function onUpdateInputs() {
const result = validateEastingNorthing(
eastingInput.value,
northingInput.value
)
if (result.valid) {
const latlong = eastingNorthingToLatLong(result.value)
/** @type {MapCenter} */
const center = [latlong.long, latlong.lat]
centerMap(map, mapProvider, center)
}
}
eastingInput.addEventListener('change', onUpdateInputs, false)
northingInput.addEventListener('change', onUpdateInputs, false)
}
/**
* Bind an OS grid reference field to the map
* @param {HTMLDivElement} locationField - the osgridref location field
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
*/
function bindOsGridRefField(locationField, map, mapProvider) {
const osGridRefInput = getOsGridRefInput(locationField)
map.on(
EVENTS.interactMarkerChange,
/**
* Callback function which fires when the map marker changes
* @param {object} e - the event
* @param {[number, number]} e.coords - the map marker coordinates
*/
function onInteractMarkerChange(e) {
const point = latLongToOsGridRef({
lat: e.coords[1],
long: e.coords[0]
})
osGridRefInput.value = point
}
)
/**
* OS grid reference input change event listener
* Update the map view location when the input is changed
*/
function onUpdateInput() {
const result = validateOsGridRef(osGridRefInput.value)
if (result.valid) {
const latlong = osGridRefToLatLong(result.value)
/** @type {MapCenter} */
const center = [latlong.long, latlong.lat]
centerMap(map, mapProvider, center)
}
}
osGridRefInput.addEventListener('change', onUpdateInput, false)
}
/**
* Updates the marker position and moves the map view port the new location
* @param {InteractiveMap} map - the map component instance (of InteractiveMap)
* @param {MapLibreMap} mapProvider - the map provider instance (of MapLibreMap)
* @param {MapCenter} center - the point
*/
function centerMap(map, mapProvider, center) {
// Move the 'location' marker to the new point
map.addMarker('location', center)
// Pan & zoom the map to the new valid location
mapProvider.flyTo({
center,
zoom: 14,
essential: true
})
}
/**
* @typedef {object} InteractiveMap - an instance of a InteractiveMap
* @property {Function} on - register callback listeners to map events
* @property {Function} addPanel - adds a new panel to the map
* @property {Function} addMarker - adds/updates a marker
*/
/**
* @typedef {object} MapLibreMap
* @property {Function} flyTo - pans/zooms to a new location
*/
/**
* @typedef {[number, number]} MapCenter - Map center point as [long, lat]
*/
/**
* @typedef {object} InteractiveMapInitConfig - additional config that can be provided to InteractiveMap
* @property {string} zoom - the zoom level of the map
* @property {MapCenter} center - the center point of the map
* @property {{ id: string, coords: MapCenter}[]} [markers] - the markers to add to the map
*/
/**
* @typedef {object} TileData
* @property {string} VTS_OUTDOOR_URL - the outdoor tile URL
* @property {string} VTS_DARK_URL - the dark tile URL
* @property {string} VTS_BLACK_AND_WHITE_URL - the black and white tile URL
*/
/**
* @typedef {object} MapsEnvironmentConfig
* @property {string} assetPath - the root asset path
* @property {string} apiPath - the root API path
* @property {TileData} data - the tile data config
*/