geoJSON = {
const features = [];
for (let y = 0; y < worldGrid.header.nrows; y++) {
for (let x = 0; x < worldGrid.header.ncols; x++) {
const density = worldGrid.data[y][x];
if (density > 0) {
features.push({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [x - 179.5, -y + 89.5]
},
"properties": {
"density": density/12000,
"color": colorScale(density/12000)
}
});
}
}
}
return { type: "FeatureCollection", features }
}