From 85692701151dc44d12e83169d6a76f0c02245edf Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 6 Sep 2021 19:12:40 +1000 Subject: [PATCH 1/3] add nsla overlay for ILS layer Changed the "library management software" layer so that there are 2 overlays: Local libraries, and NSLA libraries. Resolves #119 --- website/data/nsla_library_locations.csv | 20 +-- website/load-map.js | 164 ++++++++++++++---------- 2 files changed, 109 insertions(+), 75 deletions(-) diff --git a/website/data/nsla_library_locations.csv b/website/data/nsla_library_locations.csv index dc9b19f..d7c3d86 100644 --- a/website/data/nsla_library_locations.csv +++ b/website/data/nsla_library_locations.csv @@ -1,10 +1,10 @@ -lat,lng,town,address,phone --37.809815,144.96513,State Library of Victoria,"328 Swanston Street, Melbourne",03 8664 7000 --35.2964664654173,149.129530279015,National Library of Australia,"Parkes Place, Canberra",02 6262 1111 --33.8658844393665,151.213300984753,State Library of New South Wales,"Macquarie Street, Sydney",02 9273 1414 --27.4709532627151,153.018134355766,State Library of Queensland,"Stanley Place, South Brisbane",07 3840 7666 --34.9203274502345,138.602616669435,State Library of South Australia,"North Terrace & Kintore Ave, Adelaide",08 8207 7250 --31.9490538016994,115.860634584705,State Library of Western Australia,"25 Francis St, Perth",08 9427 3111 --42.8815965006531,147.325005456166,Hobart Reading Room (State Reference Library),"91 Murray Street, Hobart",03 6165 5597 --12.4666020117882,130.842962053658,Northern Territory Library,"4 Bennett St, Parliament House, Darwin",08 8999 7177 --35.3241714564223,149.164639259617,ACT Heritage Library,"255 Canberra Ave, Fyshwick",02 6207 5163 +lat,lng,town,address,phone,ils +-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,Ex Libris Voyager +-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,Ex Libris Alma +-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,Innovative Sierra +-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,OCLC WorldShare +-35.3241714564223,149.164639259617,ACT Heritage Library,"255 Canberra Ave, Fyshwick",02 6207 5163,Civica Spydus diff --git a/website/load-map.js b/website/load-map.js index b098d26..82e10e6 100644 --- a/website/load-map.js +++ b/website/load-map.js @@ -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.color = color; + this.outline = outline; + this.type = type; return L.layerGroup([ L.geoCsv(data, { firstLineTitles: true, fieldSeparator: ',', onEachFeature: function (feature, layer) { - layer.bindPopup( - `${feature.properties.town}` + - `

${feature.properties.address}
` + - `phone: ${feature.properties.phone}

` - ) + if (type === 'ils') { + layer.bindPopup( + `${feature.properties.town}` + + `

${feature.properties.ils}

` + ) + } else { + layer.bindPopup( + `${feature.properties.town}` + + `

${feature.properties.address}
` + + `phone: ${feature.properties.phone}

` + ) + } }, 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, { @@ -56,7 +87,8 @@ function LocationsLayer(data, color) { ) }, 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 - const branches = new LocationsLayer(data[1], "#FF3961") - const ikcs = new LocationsLayer(data[2], "#76DBA7") - const mechsAndSoA = new LocationsLayer(data[3], "rgb(255,165,0)") - const otherLibs = new LocationsLayer(data[4], "#75f857") + const branches = new LocationsLayer(data[1], '#FF3961', 800) + const ikcs = new LocationsLayer(data[2], '#76DBA7', 800) + 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') // add to the initial map on load branches.addTo(map) ikcs.addTo(map) @@ -111,8 +144,8 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) return { fillColor: getFinesColor(feature.properties.fines), weight: 3, - color: "white", - dashArray: "4", + color: 'white', + dashArray: '4', fillOpacity: 0.2 } }, @@ -177,10 +210,10 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) style: function(feature){ return { weight: 3, - color: "#fff", - dashArray: "4", + color: '#fff', + dashArray: '4', fillOpacity: 0.2, - fillColor: "#bbb", + fillColor: '#bbb', fillPattern: getLoanFillPattern(feature.properties.standard_loan_weeks) } }, @@ -199,8 +232,8 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) return { fillColor: getIlsColor(feature.properties.ILS), weight: 3, - color: "white", - dashArray: "4", + color: 'white', + dashArray: '4', fillOpacity: 0.2 } }, @@ -218,9 +251,9 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) // control layers // ++++++++++++++ const baseMaps = { - "Libraries" : baseMap, - "Rules" : baseRules, - "Library Management Software" : baseIls + 'Libraries' : baseMap, + 'Rules' : baseRules, + 'Library Management Software' : baseIls } // change the branches overlay names depending on the mode. @@ -230,24 +263,24 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) function setGeneral() { overlayMaps = { - "Settler Knowledge Centres" : branches, - "Indigenous Knowledge Centres" : ikcs, - "Mechanics Institutes" : mechsAndSoA, - "Colonial Knowledge Centres" : otherLibs + 'Settler Knowledge Centres' : branches, + 'Indigenous Knowledge Centres' : ikcs, + 'Mechanics Institutes' : mechsAndSoA, + 'Colonial Knowledge Centres' : otherLibs } modeButton.setAttribute('class', 'visible'); - modeButton.innerText = "View in Colonial Mode"; + modeButton.innerText = 'View in Colonial Mode'; } function setColonial() { overlayMaps = { - "Public Libraries" : branches, - "Indigenous Knowledge Centres" : ikcs, - "Mechanics Institutes" : mechsAndSoA, - "National & State Libraries" : otherLibs + 'Public Libraries' : branches, + 'Indigenous Knowledge Centres' : ikcs, + 'Mechanics Institutes' : mechsAndSoA, + 'National & State Libraries' : otherLibs }; modeButton.setAttribute('class', 'visible'); - modeButton.innerText = "View in Standard Mode"; + modeButton.innerText = 'View in Standard Mode'; } if (sessionStorage.getItem('mapMode') === 'colonial') { @@ -260,7 +293,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) var mapControl = L.control.layers( baseMaps, overlayMaps, - { "collapsed" : isSmallScreen } + { 'collapsed' : isSmallScreen } ).addTo(map); // scale @@ -281,7 +314,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) setGeneral() mapControl.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) { infoBoxes.branches.addTo(map) } @@ -290,7 +323,7 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) setColonial() mapControl.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) { infoBoxes.branches.addTo(map) } @@ -307,32 +340,13 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) 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 function highlightFeature(e) { const layer = e.target; layer.setStyle({ weight: 6, color: '#FF3961', - dashArray: "0", + dashArray: '0', fillOpacity: 0 }); @@ -351,18 +365,18 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) ${props.name}` + `

Fines: ` + ( - props.fines === "no" ? "No" : - props.fines == "no_unconfirmed" ? "Probably no" : - props.fines === "yes" ? "Yes" : - props.fines == "adults" ? "No for children" : - props.fines == "by_lga" ? "Varies by LGA" : "Unknown" + props.fines === 'no' ? 'No' : + props.fines == 'no_unconfirmed' ? 'Probably no' : + props.fines === 'yes' ? 'Yes' : + props.fines == 'adults' ? 'No for children' : + props.fines == 'by_lga' ? 'Varies by LGA' : 'Unknown' ) + `
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`) + `
Software : ` + - (!props.ILS || props.ILS == "?" ? `Unknown` : `${props.ILS}`) + + (!props.ILS || props.ILS == '?' ? `Unknown` : `${props.ILS}`) + `
Website: ` + - (!props.website || props.website == "?" ? `Unknown` : `` + `${props.website}` + ``) + + (!props.website || props.website == '?' ? `Unknown` : `` + `${props.website}` + ``) + `

` ).openPopup() } @@ -479,6 +493,12 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) // we remove info boxes before adding them again where relevant // this is so we don't accidentally stack up multiple copies dependng on user // navigation journey + + var ilsMaps = { + "NSLA Libraries" : nslaLibs, + "Local Libraries" : ils + } + map.on('baselayerchange', l => { for (let k in infoBoxes) { infoBoxes[k].remove() @@ -493,7 +513,11 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) mapControl.removeLayer(overlayMaps[i]) 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 infoBoxes.loanPeriod.addTo(map) infoBoxes.fines.addTo(map) @@ -510,14 +534,24 @@ Promise.all([boundaries, branchesCsv, ikcCsv, mechanics, nslaBranches]) fines.remove() loanPeriod.remove() // add ILS layer + // TODO: here we add NSLA libraries + // mapControl.addOverlay(nslaLibs, "National/State libraries") + // mapControl.addOverlay(ils, "Local Libraries") ils.addTo(map) + nslaLibs.addTo(map) + for (let k in ilsMaps ) { + mapControl.addOverlay(ilsMaps[k], k) + } } else { // if 'Libraries' layer... mapControl.removeLayer(fines) mapControl.removeLayer(loanPeriod) fines.remove() loanPeriod.remove() - ils.remove() + for (let i in ilsMaps ) { + mapControl.removeLayer(ilsMaps[i]) + ilsMaps[i].remove() + } branches.addTo(map) for (let k in overlayMaps ) { mapControl.addOverlay(overlayMaps[k], k) From 87b472c70d06f69482edc00e72a67e8f55369f48 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 6 Sep 2021 19:20:19 +1000 Subject: [PATCH 2/3] updated contributing page --- contributing.md | 4 ++-- website/contributing/index.html | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contributing.md b/contributing.md index 196047c..e4ab3ce 100644 --- a/contributing.md +++ b/contributing.md @@ -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 -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 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. diff --git a/website/contributing/index.html b/website/contributing/index.html index 5c2b1ff..a486ce6 100644 --- a/website/contributing/index.html +++ b/website/contributing/index.html @@ -32,15 +32,15 @@

I’d love your help to make Library Map as accurate and useful as possible.

How to contribute your idea, bug report or improvement

    -
  1. Look at the current GitHub issues tagged help wantedto see if you can help. Most of these will be to do with updating data, like finding street addresses or other information.
  2. +
  3. Look at the current GitHub issues tagged help wanted to see if you can help. Most of these will be to do with updating data, like finding street addresses or other information.
  4. You can create a new issue on GitHub.
  5. -
  6. You can send a pull request — though it is strongly preferred 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.
  7. +
  8. You can send a pull request — though it is strongly preferred 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.
  9. You can just send an email to librarymap@hugh.run and ask me to fix/add something.

If you have not used Git or GitHub before

There is a class outline for an introduction to Git and GitHub aimed at librarians at librarycarpentry.org. This assumes you are using the command line. If you create or already have a GitHub account, you can also edit files directly in the browser, or use GitHub Desktop - both of which are probably less intimidating options if you don’t have any desire to learn how to use a command line/shell interface, or just want to make a single minor update.

Which files to update

-

To update information about library services (e.g. fines info, loan period etc) you should edit website/data/library_services_information.csv

+

To update information about library services (e.g. fines info, loan period etc) you should edit website/data/library_services_information.csv.

After your Pull Request is merged, a GitHub Action will automatically create a second pull request that merges data from website/data/library_services_information.csv into website/data/boundaries.topo.json. Please do not edit the topo.json file directly.

To update information about library locations (e.g. street address, phone number, coordinates) you should edit the relevant csv location file: