diff --git a/projects/project-2/aufgabe1.js b/projects/project-2/aufgabe1.js
index a5fd4e6..39f0820 100644
--- a/projects/project-2/aufgabe1.js
+++ b/projects/project-2/aufgabe1.js
@@ -9,24 +9,24 @@ const aufgabe1 = () => {
const levels = [0, 20, 50, 100, 200, 250, 300, 400]
let geojson;
- const getColor = population => {
+ const getColor = density => {
switch (true) {
- case population > levels[7]:
+ case density > levels[7]:
return '#800026'
- case population > levels[6]:
+ case density > levels[6]:
return '#BD0026'
- case population > levels[5]:
+ case density > levels[5]:
return '#E31A1C'
- case population > levels[4]:
+ case density > levels[4]:
return '#FC4E2A'
- case population > levels[3]:
+ case density > levels[3]:
return '#FD8D3C'
- case population > levels[2]:
+ case density > levels[2]:
return '#FEB24C'
- case population > levels[1]:
+ case density > levels[1]:
return '#FED976'
- case population > levels[0]:
- return '#ffdb83'
+ case density > levels[0]:
+ return '#FFEDA0'
default:
return '#ffdea1'
}
@@ -40,9 +40,10 @@ const aufgabe1 = () => {
const labels = []
for (let i = 0; i < levels.length; i++) {
- let from = levels[i] + 1
- let to = levels[i + 1] + 1
- labels.push(' ' + from + (to ? '–' + to : '+'))
+ labels.push(
+ ' '
+ + levels[i] + (levels[i + 1] ? '–' + levels[i + 1] : '+')
+ )
}
legend.innerHTML = labels.join('
')
@@ -109,9 +110,7 @@ const aufgabe1 = () => {
// Load data in
$.getJSON('europe.geo.json', data => {
- for (let [idx, country] of data.features.entries()) {
- data.features[idx].properties.density = country.properties.pop_est / (turf.area(country) / 1_000_000)
- }
+ data.features.map(feature => feature.properties.density = feature.properties.pop_est / (turf.area(feature) / 1_000_000))
geojson = L.geoJson(data, {style: getStyle, onEachFeature}).addTo(map)
})