Merge pull request #136 from hughrun/nsla-overlay

nsla overlay
fixes #119
This commit is contained in:
Hugh Rundle 2021-09-06 19:25:56 +10:00 committed by GitHub
commit 0da9058114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 85 deletions

View file

@ -32,11 +32,11 @@ If you are adding a lot of data and have a new source for it, make sure it is ci
### Missing or inaccurate data ### Missing or inaccurate data
Currently we're missing data for some library services in relation to **standard loan periods** and **fines for overdue items**. Currently we're missing data for some library services in relation to **standard loan periods** and **fines for overdue items**. Any acurate and specific information about fines for South and Western Australia would be particularly helpful.
It's likely that some **library location data** is inaccurate — especially for New South Wales. It's also possible that the address data is wrong (even though the location shown may be correct), and in some cases it is missing. It's likely that some **library location data** is inaccurate — especially for New South Wales. It's also possible that the address data is wrong (even though the location shown may be correct), and in some cases it is missing.
It's possible that some of the **fines data for Queensland** is a little off. This came from the State Library of Queensland but I know for a fact that some of the data was wrong (e.g. Gold Coast Libraries does not charge overdue fines, but the SLQ reports says it does). It's possible that some of the **fines data for Queensland** is a little off. This came from the State Library of Queensland but some of the data was wrong (e.g. Gold Coast Libraries does not charge overdue fines, but the SLQ report says it does).
I am particularly interested if you know of data sources for entire regions, states, or Australia — especially if they're reliably kept up to date. I am particularly interested if you know of data sources for entire regions, states, or Australia — especially if they're reliably kept up to date.

View file

@ -32,15 +32,15 @@
<p>Id love your help to make <em>Library Map</em> as accurate and useful as possible.</p> <p>Id love your help to make <em>Library Map</em> as accurate and useful as possible.</p>
<h3 id="how-to-contribute-your-idea-bug-report-or-improvement">How to contribute your idea, bug report or improvement</h3> <h3 id="how-to-contribute-your-idea-bug-report-or-improvement">How to contribute your idea, bug report or improvement</h3>
<ol type="1"> <ol type="1">
<li>Look at the <a href="https://github.com/hughrun/public_library_map/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22">current GitHub issues tagged <code>help wanted</code></a>to see if you can help. Most of these will be to do with updating data, like finding street addresses or other information.</li> <li>Look at the <a href="https://github.com/hughrun/public_library_map/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22">current GitHub issues tagged <code>help wanted</code></a> to see if you can help. Most of these will be to do with updating data, like finding street addresses or other information.</li>
<li>You can <a href="https://github.com/hughrun/public_library_map/issues">create a new issue</a> on GitHub.</li> <li>You can <a href="https://github.com/hughrun/public_library_map/issues">create a new issue</a> on GitHub.</li>
<li>You can <a href="https://docs.github.com/en/github/.collaborating-with-issues-and-pull-requests/about-pull-requests">send a pull request</a> — though it is <em>strongly preferred</em> that you either ask to be assigned to an existing issue (so everyone knows you're working on it), or create a new issue, first.</li> <li>You can <a href="https://docs.github.com/en/github/.collaborating-with-issues-and-pull-requests/about-pull-requests">send a pull request</a> — though it is <em>strongly preferred</em> that you either ask to be assigned to an existing issue (so everyone knows youre working on it), or create a new issue, first.</li>
<li>You can just send an email to <code>librarymap</code>@<code>hugh</code>.<code>run</code> and ask me to fix/add something.</li> <li>You can just send an email to <code>librarymap</code>@<code>hugh</code>.<code>run</code> and ask me to fix/add something.</li>
</ol> </ol>
<h3 id="if-you-have-not-used-git-or-github-before">If you have not used Git or GitHub before</h3> <h3 id="if-you-have-not-used-git-or-github-before">If you have not used Git or GitHub before</h3>
<p>There is a class outline for an <a href="https://librarycarpentry.org/lc-git/">introduction to Git and GitHub aimed at librarians</a> at <code>librarycarpentry.org</code>. This assumes you are using the command line. If you create or already have a GitHub account, you can also <a href="https://docs.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository">edit files directly in the browser</a>, or use <a href="https://desktop.github.com/">GitHub Desktop</a> - both of which are probably less intimidating options if you dont have any desire to learn how to use a command line/shell interface, or just want to make a single minor update.</p> <p>There is a class outline for an <a href="https://librarycarpentry.org/lc-git/">introduction to Git and GitHub aimed at librarians</a> at <code>librarycarpentry.org</code>. This assumes you are using the command line. If you create or already have a GitHub account, you can also <a href="https://docs.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository">edit files directly in the browser</a>, or use <a href="https://desktop.github.com/">GitHub Desktop</a> - both of which are probably less intimidating options if you dont have any desire to learn how to use a command line/shell interface, or just want to make a single minor update.</p>
<h3 id="which-files-to-update">Which files to update</h3> <h3 id="which-files-to-update">Which files to update</h3>
<p>To update information about library <em>services</em> (e.g. fines info, loan period etc) you should edit <code>website/data/library_services_information.csv</code></p> <p>To update information about library <em>services</em> (e.g. fines info, loan period etc) you should edit <code>website/data/library_services_information.csv</code>.</p>
<p>After your Pull Request is merged, a GitHub Action will automatically create a second pull request that merges data from <code>website/data/library_services_information.csv</code> into <code>website/data/boundaries.topo.json</code>. Please do not edit the <code>topo.json</code> file directly.</p> <p>After your Pull Request is merged, a GitHub Action will automatically create a second pull request that merges data from <code>website/data/library_services_information.csv</code> into <code>website/data/boundaries.topo.json</code>. Please do not edit the <code>topo.json</code> file directly.</p>
<p>To update information about library <em>locations</em> (e.g. street address, phone number, coordinates) you should edit the relevant csv location file:</p> <p>To update information about library <em>locations</em> (e.g. street address, phone number, coordinates) you should edit the relevant csv location file:</p>
<ul> <ul>
@ -52,17 +52,17 @@
<h3 id="citing-and-crediting-data-sources">Citing and crediting data sources</h3> <h3 id="citing-and-crediting-data-sources">Citing and crediting data sources</h3>
<p>If you are adding a lot of data and have a new source for it, make sure it is cited. You should update the list of sources at both <code>sources.md</code> <em>and</em> <code>website/sources/index.html</code>. If your source is “I just know because its my local library” or “I looked it up on their website” you dont need to add that to the list of sources. If your source is “I found a PDF listing every public library on the State Library website”, you do.</p> <p>If you are adding a lot of data and have a new source for it, make sure it is cited. You should update the list of sources at both <code>sources.md</code> <em>and</em> <code>website/sources/index.html</code>. If your source is “I just know because its my local library” or “I looked it up on their website” you dont need to add that to the list of sources. If your source is “I found a PDF listing every public library on the State Library website”, you do.</p>
<h3 id="missing-or-inaccurate-data">Missing or inaccurate data</h3> <h3 id="missing-or-inaccurate-data">Missing or inaccurate data</h3>
<p>Currently were missing data for some library services in relation to <strong>standard loan periods</strong> and <strong>fines for overdue items</strong>.</p> <p>Currently were missing data for some library services in relation to <strong>standard loan periods</strong> and <strong>fines for overdue items</strong>. Any acurate and specific information about fines for South and Western Australia would be particularly helpful.</p>
<p>Its likely that some <strong>library location data</strong> is inaccurate — especially for New South Wales. Its also possible that the address data is wrong (even though the location shown may be correct), and in some cases it is missing.</p> <p>Its likely that some <strong>library location data</strong> is inaccurate — especially for New South Wales. Its also possible that the address data is wrong (even though the location shown may be correct), and in some cases it is missing.</p>
<p>Its possible that some of the <strong>fines data for Queensland</strong> is a little off. This came from the State Library of Queensland but I know for a fact that some of the data was wrong (e.g. Gold Coast Libraries does not charge overdue fines, but the SLQ reports says it does).</p> <p>Its possible that some of the <strong>fines data for Queensland</strong> is a little off. This came from the State Library of Queensland but some of the data was wrong (e.g. Gold Coast Libraries does not charge overdue fines, but the SLQ report says it does).</p>
<p>I am particularly interested if you know of data sources for entire regions, states, or Australia — especially if theyre reliably kept up to date.</p> <p>I am particularly interested if you know of data sources for entire regions, states, or Australia — especially if theyre reliably kept up to date.</p>
<p>If you can fill in any of these blanks, please update the relevant CSV file and send a pull request. If your data is coming from somewhere in particular, you should also add that to <code>sources.md</code> in the relevant table.</p> <p>If you can fill in any of these blanks, please update the relevant CSV file and send a pull request. If your data is coming from somewhere in particular, you should also add that to <code>sources.md</code> in the relevant table.</p>
<h3 id="ideas-for-additional-data">Ideas for additional data</h3> <h3 id="ideas-for-additional-data">Ideas for additional data</h3>
<p>You might have an idea for library data that would be useful to map. Im really happy to hear about these ideas! Its possible that the information you want to map is unavailable, or just really hard to get, or maybe I will disagree that its useful. Thats ok - please ask anyway, expecially if you know where to find the data.</p> <p>You might have an idea for library data that would be useful to map. Im really happy to hear about these ideas! Its possible that the information you want to map is unavailable, or just really hard to get, or maybe I will disagree that its useful. Thats ok - please ask anyway, especially if you know where to find the data.</p>
<h3 id="improvements-to-documentation">Improvements to documentation</h3> <h3 id="improvements-to-documentation">Improvements to documentation</h3>
<p>Im always — <em>always</em> — happy to hear how I can improve documentation. Even better if you make the edit and then send a pull request.</p> <p>Im always — <em>always</em> — happy to hear how I can improve documentation. Even better if you make the edit and then send a pull request.</p>
<h3 id="improvements-to-the-website-design-layout-or-information">Improvements to the website design, layout, or information</h3> <h3 id="improvements-to-the-website-design-layout-or-information">Improvements to the website design, layout, or information</h3>
<p>You might have an idea for an improvement thats not about the data per se, but rather about the website. Maybe theres some accessibilty improvements I can make. Let me know!</p> <p>You might have an idea for an improvement thats not about the data per se, but rather about the website. Maybe theres some accessibility improvements I can make. Let me know!</p>
<h3 id="licensing-and-copyright">Licensing and copyright</h3> <h3 id="licensing-and-copyright">Licensing and copyright</h3>
<p>By contributing to this project you agree to license your work under the following licenses:</p> <p>By contributing to this project you agree to license your work under the following licenses:</p>
<p><strong>/website/data/*</strong>: <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a></p> <p><strong>/website/data/*</strong>: <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a></p>

View file

@ -428,4 +428,4 @@ Wyndham-East Kimberley Shire Council,Wyndham-East Kimberley,wa,,2,Follett Destin
Yalgoo Shire Council,Yalgoo,wa,,?,OCLC Amlib,https://www.yalgoo.wa.gov.au/town-services/services-public-library.aspx, Yalgoo Shire Council,Yalgoo,wa,,?,OCLC Amlib,https://www.yalgoo.wa.gov.au/town-services/services-public-library.aspx,
Yilgarn Shire Council,Yilgarn,wa,yes,2,OCLC Amlib,https://www.yilgarn.wa.gov.au/crc/library/southern-cross-public-library.aspx, Yilgarn Shire Council,Yilgarn,wa,yes,2,OCLC Amlib,https://www.yilgarn.wa.gov.au/crc/library/southern-cross-public-library.aspx,
York Shire Council,York,wa,,3,OCLC Amlib,https://www.york.wa.gov.au/community/facilities/library.aspx, York Shire Council,York,wa,,3,OCLC Amlib,https://www.york.wa.gov.au/community/facilities/library.aspx,
Warrnambool City Council,Warrnambool,vic,?,3,Spydus,https://library.warrnambool.vic.gov.au/, Warrnambool City Council,Warrnambool,vic,?,3,Civica Spydus,https://library.warrnambool.vic.gov.au/,

1 long_name name state fines standard_loan_weeks ILS website
428 Yalgoo Shire Council Yalgoo wa ? OCLC Amlib https://www.yalgoo.wa.gov.au/town-services/services-public-library.aspx
429 Yilgarn Shire Council Yilgarn wa yes 2 OCLC Amlib https://www.yilgarn.wa.gov.au/crc/library/southern-cross-public-library.aspx
430 York Shire Council York wa 3 OCLC Amlib https://www.york.wa.gov.au/community/facilities/library.aspx
431 Warrnambool City Council Warrnambool vic ? 3 Spydus Civica Spydus https://library.warrnambool.vic.gov.au/

View file

@ -1,10 +1,10 @@
lat,lng,town,address,phone lat,lng,town,address,phone,ils
-37.809815,144.96513,State Library of Victoria,"328 Swanston Street, Melbourne",03 8664 7000 -37.809815,144.96513,State Library of Victoria,"328 Swanston Street, Melbourne",03 8664 7000,Ex Libris Voyager
-35.2964664654173,149.129530279015,National Library of Australia,"Parkes Place, Canberra",02 6262 1111 -35.2964664654173,149.129530279015,National Library of Australia,"Parkes Place, Canberra",02 6262 1111,Ex Libris Voyager
-33.8658844393665,151.213300984753,State Library of New South Wales,"Macquarie Street, Sydney",02 9273 1414 -33.8658844393665,151.213300984753,State Library of New South Wales,"Macquarie Street, Sydney",02 9273 1414,Ex Libris Alma
-27.4709532627151,153.018134355766,State Library of Queensland,"Stanley Place, South Brisbane",07 3840 7666 -27.4709532627151,153.018134355766,State Library of Queensland,"Stanley Place, South Brisbane",07 3840 7666,Ex Libris Alma
-34.9203274502345,138.602616669435,State Library of South Australia,"North Terrace & Kintore Ave, Adelaide",08 8207 7250 -34.9203274502345,138.602616669435,State Library of South Australia,"North Terrace & Kintore Ave, Adelaide",08 8207 7250,Innovative Sierra
-31.9490538016994,115.860634584705,State Library of Western Australia,"25 Francis St, Perth",08 9427 3111 -31.9490538016994,115.860634584705,State Library of Western Australia,"25 Francis St, Perth",08 9427 3111,Innovative Sierra
-42.8815965006531,147.325005456166,Hobart Reading Room (State Reference Library),"91 Murray Street, Hobart",03 6165 5597 -42.8815965006531,147.325005456166,Hobart Reading Room (State Reference Library),"91 Murray Street, Hobart",03 6165 5597,SirsiDynix Symphony
-12.4666020117882,130.842962053658,Northern Territory Library,"4 Bennett St, Parliament House, Darwin",08 8999 7177 -12.4666020117882,130.842962053658,Northern Territory Library,"4 Bennett St, Parliament House, Darwin",08 8999 7177,OCLC WorldShare
-35.3241714564223,149.164639259617,ACT Heritage Library,"255 Canberra Ave, Fyshwick",02 6207 5163 -35.3241714564223,149.164639259617,ACT Heritage Library,"255 Canberra Ave, Fyshwick",02 6207 5163,Civica Spydus

1 lat lng town address phone ils
2 -37.809815 144.96513 State Library of Victoria 328 Swanston Street, Melbourne 03 8664 7000 Ex Libris Voyager
3 -35.2964664654173 149.129530279015 National Library of Australia Parkes Place, Canberra 02 6262 1111 Ex Libris Voyager
4 -33.8658844393665 151.213300984753 State Library of New South Wales Macquarie Street, Sydney 02 9273 1414 Ex Libris Alma
5 -27.4709532627151 153.018134355766 State Library of Queensland Stanley Place, South Brisbane 07 3840 7666 Ex Libris Alma
6 -34.9203274502345 138.602616669435 State Library of South Australia North Terrace & Kintore Ave, Adelaide 08 8207 7250 Innovative Sierra
7 -31.9490538016994 115.860634584705 State Library of Western Australia 25 Francis St, Perth 08 9427 3111 Innovative Sierra
8 -42.8815965006531 147.325005456166 Hobart Reading Room (State Reference Library) 91 Murray Street, Hobart 03 6165 5597 SirsiDynix Symphony
9 -12.4666020117882 130.842962053658 Northern Territory Library 4 Bennett St, Parliament House, Darwin 08 8999 7177 OCLC WorldShare
10 -35.3241714564223 149.164639259617 ACT Heritage Library 255 Canberra Ave, Fyshwick 02 6207 5163 Civica Spydus

View file

@ -27,22 +27,53 @@ function BaseMap(id) {
}) })
} }
function LocationsLayer(data, color) { function getIlsColor(f) {
return f == 'AIT Aurora' ? '#d16a6e' :
f == 'Champ LMSi' ? '#ff00db' :
f == 'Civica Spydus' ? '#800080' :
f == 'DECD Bookmark' ? '#e1153e' :
f == 'Ex Libris Alma' ? '#ff6500' :
f == 'Ex Libris Voyager' ? 'yellow' :
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 WorldShare' ? '#2fbf97' :
f == 'SirsiDynix Horizon' ? '#ffff00' :
f == 'SirsiDynix Symphony' ? '#115583' :
f == 'Softlink Liberty' ? '#00f9ff' :
f == 'SumWare Athenaeum' ? '#ff3232' : '#bbb';
}
function LocationsLayer(data, color, outline, type) {
this.data = data; this.data = data;
this.color = color; this.color = color;
this.outline = outline;
this.type = type;
return L.layerGroup([ return L.layerGroup([
L.geoCsv(data, { L.geoCsv(data, {
firstLineTitles: true, firstLineTitles: true,
fieldSeparator: ',', fieldSeparator: ',',
onEachFeature: function (feature, layer) { onEachFeature: function (feature, layer) {
layer.bindPopup( if (type === 'ils') {
`<strong>${feature.properties.town}</strong>` + layer.bindPopup(
`<p>${feature.properties.address}<br/>` + `<strong>${feature.properties.town}</strong>` +
`phone: ${feature.properties.phone}</p>` `<p>${feature.properties.ils}</p>`
) )
} else {
layer.bindPopup(
`<strong>${feature.properties.town}</strong>` +
`<p>${feature.properties.address}<br/>` +
`phone: ${feature.properties.phone}</p>`
)
}
}, },
pointToLayer: function (f, latlng) { pointToLayer: function (f, latlng) {
return L.circle(latlng, {color: color, radius: 800}) // this is an 800m radius around the library let col = type === 'ils' ? getIlsColor(f.properties.ils) : color;
return L.circle(latlng, {color: col, radius: outline}) // this is an 800m radius around the library
} }
}), }),
L.geoCsv(data, { L.geoCsv(data, {
@ -56,7 +87,8 @@ function LocationsLayer(data, color) {
) )
}, },
pointToLayer: function (f, latlng) { pointToLayer: function (f, latlng) {
return L.circleMarker(latlng, {color: color, radius: 2, fill: true}) let col = type === 'ils' ? getIlsColor(f.properties.ils) : color;
return L.circleMarker(latlng, {color: col, radius: 2, fill: true})
} }
}) })
]) ])
@ -78,10 +110,11 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
}); });
// LOCATION LAYERS // LOCATION LAYERS
const branches = new LocationsLayer(data[1], "#FF3961") const branches = new LocationsLayer(data[1], '#FF3961', 800)
const ikcs = new LocationsLayer(data[2], "#76DBA7") const ikcs = new LocationsLayer(data[2], '#76DBA7', 800)
const mechsAndSoA = new LocationsLayer(data[3], "rgb(255,165,0)") const mechsAndSoA = new LocationsLayer(data[3], 'rgb(255,165,0)', 800)
const otherLibs = new LocationsLayer(data[4], "#75f857") const otherLibs = new LocationsLayer(data[4], '#75f857', 800)
const nslaLibs = new LocationsLayer(data[4], '#FF3961', 20000, 'ils')
// add to the initial map on load // add to the initial map on load
branches.addTo(map) branches.addTo(map)
ikcs.addTo(map) ikcs.addTo(map)
@ -111,8 +144,8 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
return { return {
fillColor: getFinesColor(feature.properties.fines), fillColor: getFinesColor(feature.properties.fines),
weight: 3, weight: 3,
color: "white", color: 'white',
dashArray: "4", dashArray: '4',
fillOpacity: 0.2 fillOpacity: 0.2
} }
}, },
@ -177,10 +210,10 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
style: function(feature){ style: function(feature){
return { return {
weight: 3, weight: 3,
color: "#fff", color: '#fff',
dashArray: "4", dashArray: '4',
fillOpacity: 0.2, fillOpacity: 0.2,
fillColor: "#bbb", fillColor: '#bbb',
fillPattern: getLoanFillPattern(feature.properties.standard_loan_weeks) fillPattern: getLoanFillPattern(feature.properties.standard_loan_weeks)
} }
}, },
@ -199,8 +232,8 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
return { return {
fillColor: getIlsColor(feature.properties.ILS), fillColor: getIlsColor(feature.properties.ILS),
weight: 3, weight: 3,
color: "white", color: 'white',
dashArray: "4", dashArray: '4',
fillOpacity: 0.2 fillOpacity: 0.2
} }
}, },
@ -218,9 +251,9 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
// control layers // control layers
// ++++++++++++++ // ++++++++++++++
const baseMaps = { const baseMaps = {
"Libraries" : baseMap, 'Libraries' : baseMap,
"Rules" : baseRules, 'Rules' : baseRules,
"Library Management Software" : baseIls 'Library Management Software' : baseIls
} }
// change the branches overlay names depending on the mode. // change the branches overlay names depending on the mode.
@ -230,24 +263,24 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
function setGeneral() { function setGeneral() {
overlayMaps = { overlayMaps = {
"Settler Knowledge Centres" : branches, 'Settler Knowledge Centres' : branches,
"Indigenous Knowledge Centres" : ikcs, 'Indigenous Knowledge Centres' : ikcs,
"Mechanics Institutes" : mechsAndSoA, 'Mechanics Institutes' : mechsAndSoA,
"Colonial Knowledge Centres" : otherLibs 'Colonial Knowledge Centres' : otherLibs
} }
modeButton.setAttribute('class', 'visible'); modeButton.setAttribute('class', 'visible');
modeButton.innerText = "View in Colonial Mode"; modeButton.innerText = 'View in Colonial Mode';
} }
function setColonial() { function setColonial() {
overlayMaps = { overlayMaps = {
"Public Libraries" : branches, 'Public Libraries' : branches,
"Indigenous Knowledge Centres" : ikcs, 'Indigenous Knowledge Centres' : ikcs,
"Mechanics Institutes" : mechsAndSoA, 'Mechanics Institutes' : mechsAndSoA,
"National & State Libraries" : otherLibs 'National & State Libraries' : otherLibs
}; };
modeButton.setAttribute('class', 'visible'); modeButton.setAttribute('class', 'visible');
modeButton.innerText = "View in Standard Mode"; modeButton.innerText = 'View in Standard Mode';
} }
if (sessionStorage.getItem('mapMode') === 'colonial') { if (sessionStorage.getItem('mapMode') === 'colonial') {
@ -260,7 +293,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
var mapControl = L.control.layers( var mapControl = L.control.layers(
baseMaps, baseMaps,
overlayMaps, overlayMaps,
{ "collapsed" : isSmallScreen } { 'collapsed' : isSmallScreen }
).addTo(map); ).addTo(map);
// scale // scale
@ -281,7 +314,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
setGeneral() setGeneral()
mapControl.remove(); mapControl.remove();
infoBoxes.branches.remove() infoBoxes.branches.remove()
mapControl = L.control.layers(baseMaps, overlayMaps, {"collapsed": isSmallScreen}).addTo(map); mapControl = L.control.layers(baseMaps, overlayMaps, {'collapsed': isSmallScreen}).addTo(map);
if (!isSmallScreen) { if (!isSmallScreen) {
infoBoxes.branches.addTo(map) infoBoxes.branches.addTo(map)
} }
@ -290,7 +323,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
setColonial() setColonial()
mapControl.remove(); mapControl.remove();
infoBoxes.branches.remove() infoBoxes.branches.remove()
mapControl = L.control.layers(baseMaps, overlayMaps, {"collapsed": isSmallScreen}).addTo(map); mapControl = L.control.layers(baseMaps, overlayMaps, {'collapsed': isSmallScreen}).addTo(map);
if (!isSmallScreen) { if (!isSmallScreen) {
infoBoxes.branches.addTo(map) infoBoxes.branches.addTo(map)
} }
@ -307,32 +340,13 @@ 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 WorldShare' ? '#2fbf97' :
f == 'SirsiDynix Horizon' ? '#ffff00' :
f == 'SirsiDynix 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;
layer.setStyle({ layer.setStyle({
weight: 6, weight: 6,
color: '#FF3961', color: '#FF3961',
dashArray: "0", dashArray: '0',
fillOpacity: 0 fillOpacity: 0
}); });
@ -351,18 +365,18 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
<strong>${props.name}</strong>` + <strong>${props.name}</strong>` +
`<p>Fines: ` + `<p>Fines: ` +
( (
props.fines === "no" ? "No" : props.fines === 'no' ? 'No' :
props.fines == "no_unconfirmed" ? "Probably no" : props.fines == 'no_unconfirmed' ? 'Probably no' :
props.fines === "yes" ? "Yes" : props.fines === 'yes' ? 'Yes' :
props.fines == "adults" ? "No for children" : props.fines == 'adults' ? 'No for children' :
props.fines == "by_lga" ? "Varies by LGA" : "Unknown" props.fines == 'by_lga' ? 'Varies by LGA' : 'Unknown'
) + ) +
`<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 : ` + `<br/>Software : ` +
(!props.ILS || props.ILS == "?" ? `Unknown` : `${props.ILS}`) + (!props.ILS || props.ILS == '?' ? `Unknown` : `${props.ILS}`) +
`<br/>Website: ` + `<br/>Website: ` +
(!props.website || props.website == "?" ? `Unknown` : `<a target="_blank" href="`+ `${props.website}` + `" >` + `${props.website}` + `</a>`) + (!props.website || props.website == '?' ? `Unknown` : `<a target="_blank" href="`+ `${props.website}` + `" >` + `${props.website}` + `</a>`) +
`</p>` `</p>`
).openPopup() ).openPopup()
} }
@ -479,6 +493,12 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
// we remove info boxes before adding them again where relevant // we remove info boxes before adding them again where relevant
// this is so we don't accidentally stack up multiple copies dependng on user // this is so we don't accidentally stack up multiple copies dependng on user
// navigation journey // navigation journey
var ilsMaps = {
"NSLA Libraries" : nslaLibs,
"Local Libraries" : ils
}
map.on('baselayerchange', l => { map.on('baselayerchange', l => {
for (let k in infoBoxes) { for (let k in infoBoxes) {
infoBoxes[k].remove() infoBoxes[k].remove()
@ -493,7 +513,11 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
mapControl.removeLayer(overlayMaps[i]) mapControl.removeLayer(overlayMaps[i])
overlayMaps[i].remove() overlayMaps[i].remove()
} }
ils.remove() for (let i in ilsMaps ) {
mapControl.removeLayer(ilsMaps[i])
ilsMaps[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)
@ -510,14 +534,24 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches])
fines.remove() fines.remove()
loanPeriod.remove() loanPeriod.remove()
// add ILS layer // add ILS layer
// TODO: here we add NSLA libraries
// mapControl.addOverlay(nslaLibs, "National/State libraries")
// mapControl.addOverlay(ils, "Local Libraries")
ils.addTo(map) ils.addTo(map)
nslaLibs.addTo(map)
for (let k in ilsMaps ) {
mapControl.addOverlay(ilsMaps[k], k)
}
} else { } else {
// if 'Libraries' layer... // if 'Libraries' layer...
mapControl.removeLayer(fines) mapControl.removeLayer(fines)
mapControl.removeLayer(loanPeriod) mapControl.removeLayer(loanPeriod)
fines.remove() fines.remove()
loanPeriod.remove() loanPeriod.remove()
ils.remove() for (let i in ilsMaps ) {
mapControl.removeLayer(ilsMaps[i])
ilsMaps[i].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)