add ILS map
Adds a layer to view the library software for each library service. Each software system is colour-coded. Adds the ILS to the infobox on hover and the popup on select.
This commit is contained in:
parent
18ebf05ec5
commit
21c0c10f08
|
@ -36,6 +36,15 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
accessToken: mapBoxToken
|
accessToken: mapBoxToken
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const baseIls = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
|
||||||
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a><br>Incorporates Administrative Boundaries ©PSMA Australia Limited licensed by the Commonwealth of Australia under Creative Commons Attribution 4.0 International licence (CC BY 4.0).',
|
||||||
|
maxZoom: 18,
|
||||||
|
id: 'mapbox/light-v10',
|
||||||
|
tileSize: 512,
|
||||||
|
zoomOffset: -1,
|
||||||
|
accessToken: mapBoxToken
|
||||||
|
});
|
||||||
|
|
||||||
// attach map to #mapid div above and centre
|
// attach map to #mapid div above and centre
|
||||||
const map = L.map('mapid', {
|
const map = L.map('mapid', {
|
||||||
center: [-27.00, 133.000],
|
center: [-27.00, 133.000],
|
||||||
|
@ -276,16 +285,37 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
})
|
})
|
||||||
]).addTo(map) // add this to the initial map on load
|
]).addTo(map) // add this to the initial map on load
|
||||||
|
|
||||||
|
// integrated library management software
|
||||||
|
const ils = new L.TopoJSON(data[0], {
|
||||||
|
style: function(feature){
|
||||||
|
return {
|
||||||
|
fillColor: getIlsColor(feature.properties.ILS),
|
||||||
|
weight: 3,
|
||||||
|
color: "white",
|
||||||
|
dashArray: "4",
|
||||||
|
fillOpacity: 0.2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onEachFeature: function onEachFeature(feature, layer) {
|
||||||
|
layer.on({
|
||||||
|
mouseover: e => highlightFeature(e),
|
||||||
|
mouseout: e => resetHighlight(e, ils),
|
||||||
|
click: e => zoomToFeature(e, feature.properties),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// ++++++++++++++
|
// ++++++++++++++
|
||||||
// control layers
|
// control layers
|
||||||
// ++++++++++++++
|
// ++++++++++++++
|
||||||
const baseMaps = {
|
const baseMaps = {
|
||||||
"Libraries" : baseMap,
|
"Libraries" : baseMap,
|
||||||
// TODO: "Languages" : baseLang,
|
|
||||||
"Rules" : baseRules,
|
"Rules" : baseRules,
|
||||||
|
"Library Management Software" : baseIls
|
||||||
}
|
}
|
||||||
|
|
||||||
// change the overlay name depending on the mode.
|
// change the branches overlay names depending on the mode.
|
||||||
const modeButton = document.getElementById('mode-button');
|
const modeButton = document.getElementById('mode-button');
|
||||||
|
|
||||||
var overlayMaps = {
|
var overlayMaps = {
|
||||||
|
@ -372,6 +402,26 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
f == 'no_unconfirmed' ? '#b8e186' : '#bbb';
|
f == 'no_unconfirmed' ? '#b8e186' : '#bbb';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getIlsColor(f) {
|
||||||
|
return f == 'AIT Aurora' ? '#d16a6e' :
|
||||||
|
f == 'Champ LMSi' ? '#ff00db' :
|
||||||
|
f == 'Civica Spydus' ? '#800080' :
|
||||||
|
f == 'DECD Bookmark' ? '#e1153e' :
|
||||||
|
f == 'Follett Destiny' ? '#df4917' :
|
||||||
|
f == 'Infor V-smart' ? '#e174c1' :
|
||||||
|
f == 'Innovative Sierra' ? '#ff0000' :
|
||||||
|
f == 'Koha ILS' ? '#2fbf2f' :
|
||||||
|
f == 'Libero' ? '#ffa500' :
|
||||||
|
f == 'Locally developed' ? '#bfdf17' :
|
||||||
|
f == 'OCLC Amlib' ? '#ddb372' :
|
||||||
|
f == 'OCLC WorldCat' ? '#3b2fbf' :
|
||||||
|
f == 'OCLC WorldShare' ? '#2fbf97' :
|
||||||
|
f == 'Sirsi Dynix Horizon' ? '#ffff00' :
|
||||||
|
f == 'Sirsi Dynix Symphony' ? '#115583' :
|
||||||
|
f == 'Softlink Liberty' ? '#00f9ff' :
|
||||||
|
f == 'SumWare Athenaeum' ? '#ff3232' : '#bbb';
|
||||||
|
}
|
||||||
|
|
||||||
// highlight feature on mouse hover
|
// highlight feature on mouse hover
|
||||||
function highlightFeature(e) {
|
function highlightFeature(e) {
|
||||||
const layer = e.target;
|
const layer = e.target;
|
||||||
|
@ -406,6 +456,8 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
) +
|
) +
|
||||||
`<br/>Loans : ` +
|
`<br/>Loans : ` +
|
||||||
(!props.standard_loan_weeks || props.standard_loan_weeks == "?" ? `Unknown` : `${props.standard_loan_weeks} weeks`) +
|
(!props.standard_loan_weeks || props.standard_loan_weeks == "?" ? `Unknown` : `${props.standard_loan_weeks} weeks`) +
|
||||||
|
`<br/>Software : ` +
|
||||||
|
(!props.ILS || props.ILS == "?" ? `Unknown` : `${props.ILS}`) +
|
||||||
`</p>`
|
`</p>`
|
||||||
).openPopup()
|
).openPopup()
|
||||||
}
|
}
|
||||||
|
@ -491,7 +543,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
`
|
`
|
||||||
};
|
};
|
||||||
|
|
||||||
// FOCUSSED AREA INFOBOX
|
// FOCUSSED AREA INFOBOX (pops up on top left)
|
||||||
infoBoxes.serviceInfo.onAdd = addLegend;
|
infoBoxes.serviceInfo.onAdd = addLegend;
|
||||||
infoBoxes.serviceInfo.update = function(props) {
|
infoBoxes.serviceInfo.update = function(props) {
|
||||||
if (props) {
|
if (props) {
|
||||||
|
@ -503,11 +555,12 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
props.fines === "yes" ? "Overdue fines for all users" :
|
props.fines === "yes" ? "Overdue fines for all users" :
|
||||||
props.fines == "adults" ? "No overdue fines for children" :
|
props.fines == "adults" ? "No overdue fines for children" :
|
||||||
props.fines == "by_lga" ? "Fine policy varies" : "No fines data"
|
props.fines == "by_lga" ? "Fine policy varies" : "No fines data"
|
||||||
) + '</p><p>' +
|
) + '<br/>' +
|
||||||
(
|
(!props.standard_loan_weeks || props.standard_loan_weeks == "?" ? `No loan period data` : `${props.standard_loan_weeks} week loans`) +
|
||||||
!props.standard_loan_weeks || props.standard_loan_weeks == "?" ? `No loan period data` : `${props.standard_loan_weeks} week loans` +
|
`<br/>Software: ` +
|
||||||
|
(!props.ILS || props.ILS == "?" ? `Unknown` : `${props.ILS}`) +
|
||||||
'</p></section>'
|
'</p></section>'
|
||||||
)}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loan period layer is always at bottom
|
// loan period layer is always at bottom
|
||||||
|
@ -526,6 +579,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
infoBoxes[k].remove()
|
infoBoxes[k].remove()
|
||||||
}
|
}
|
||||||
if (l.name == "Rules") {
|
if (l.name == "Rules") {
|
||||||
|
modeButton.setAttribute('class', 'hidden'); // hide the mode button when it's not relevant
|
||||||
mapControl.addOverlay(fines, "Fines")
|
mapControl.addOverlay(fines, "Fines")
|
||||||
mapControl.addOverlay(loanPeriod, "Loan Period")
|
mapControl.addOverlay(loanPeriod, "Loan Period")
|
||||||
loanPeriod.addTo(map)
|
loanPeriod.addTo(map)
|
||||||
|
@ -534,16 +588,31 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
|
||||||
mapControl.removeLayer(overlayMaps[i])
|
mapControl.removeLayer(overlayMaps[i])
|
||||||
overlayMaps[i].remove()
|
overlayMaps[i].remove()
|
||||||
}
|
}
|
||||||
|
ils.remove()
|
||||||
if (!isSmallScreen) { // only add infoboxes to larger screens
|
if (!isSmallScreen) { // only add infoboxes to larger screens
|
||||||
infoBoxes.loanPeriod.addTo(map)
|
infoBoxes.loanPeriod.addTo(map)
|
||||||
infoBoxes.fines.addTo(map)
|
infoBoxes.fines.addTo(map)
|
||||||
}
|
}
|
||||||
|
} else if (l.name == "Library Management Software") {
|
||||||
modeButton.setAttribute('class', 'hidden'); // hide the mode button when it's not relevant
|
modeButton.setAttribute('class', 'hidden'); // hide the mode button when it's not relevant
|
||||||
} else {
|
// remove any other layers
|
||||||
|
for (let i in overlayMaps ) {
|
||||||
|
mapControl.removeLayer(overlayMaps[i])
|
||||||
|
overlayMaps[i].remove()
|
||||||
|
}
|
||||||
mapControl.removeLayer(fines)
|
mapControl.removeLayer(fines)
|
||||||
mapControl.removeLayer(loanPeriod)
|
mapControl.removeLayer(loanPeriod)
|
||||||
fines.remove()
|
fines.remove()
|
||||||
loanPeriod.remove()
|
loanPeriod.remove()
|
||||||
|
// add ILS layer
|
||||||
|
ils.addTo(map)
|
||||||
|
} else {
|
||||||
|
// if 'Libraries' layer...
|
||||||
|
mapControl.removeLayer(fines)
|
||||||
|
mapControl.removeLayer(loanPeriod)
|
||||||
|
fines.remove()
|
||||||
|
loanPeriod.remove()
|
||||||
|
ils.remove()
|
||||||
branches.addTo(map)
|
branches.addTo(map)
|
||||||
for (let k in overlayMaps ) {
|
for (let k in overlayMaps ) {
|
||||||
mapControl.addOverlay(overlayMaps[k], k)
|
mapControl.addOverlay(overlayMaps[k], k)
|
||||||
|
|
Loading…
Reference in a new issue