Also fixes nsla libraries showing "undefined" for discovery layer
This commit is contained in:
Hugh Rundle 2024-02-11 15:04:26 +11:00
parent 9554ff9438
commit c6a7887cee
Signed by: hugh
GPG key ID: A7E35779918253F9

View file

@ -63,11 +63,18 @@ function LocationsLayer(data, color, outline, type) {
fieldSeparator: ',',
onEachFeature: function (feature, layer) {
if (type === 'ils') {
layer.bindPopup(
`<strong>${feature.properties.town}</strong>` +
`<p>${feature.properties.ils}</p>` +
`<p>${feature.properties.discovery}</p>`
)
if (feature.properties.discovery) {
layer.bindPopup(
`<strong>${feature.properties.town}</strong>` +
`<p>${feature.properties.ils}</p>` +
`<p>${feature.properties.discovery}</p>`
)
} else {
layer.bindPopup(
`<strong>${feature.properties.town}</strong>` +
`<p>${feature.properties.ils}</p>`
)
}
} else {
layer.bindPopup(
`<strong>${feature.properties.town}</strong>` +
@ -120,7 +127,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches, caul])
const mechsAndSoA = new LocationsLayer(data[3], 'rgb(255,165,0)', 800)
const otherLibs = new LocationsLayer(data[4], '#75f857', 800)
const nslaLibs = new LocationsLayer(data[4], '#FF3961', 20000, 'ils')
const academicLibs = new LocationsLayer(data[5], '#0073A1', 1000, 'ils')
const academicLibs = new LocationsLayer(data[5], '#0073A1', 5000, 'ils')
// add to the initial map on load
branches.addTo(map)
ikcs.addTo(map)