points = {
const features = [];
const { nrows, ncols, cellsize, xllcorner, yllcorner, NODATA_value } =
parsed.header;
for (let y = 0; y < nrows; y++) {
for (let x = 0; x < ncols; x++) {
features.push({
type: "Feature",
geometry: {
type: "Point",
coordinates: [
x * cellsize - (-xllcorner - cellsize / 2),
-y * cellsize + (-yllcorner - cellsize / 2)
]
},
properties: {
count: parsed.data[y][x]
}
});
}
}
return {
type: "FeatureCollection",
features: features.filter(
(d) =>
(d.properties.count !== parsed.header.NODATA_value) &
(d.properties.count > 0)
)
};
}