function countPointsInPolygons(points, polygonJson) {
let countsArray = [];
let polygonFeaturesArray = polygonJson.features;
for (let i = 0; i < polygonFeaturesArray.length; i++) {
let iGeometry = turf.polygon(polygonFeaturesArray[i].geometry.coordinates);
let pointsWithinPolygon = turf.pointsWithinPolygon(points, iGeometry);
iGeometry.properties.count = pointsWithinPolygon.features.length;
countsArray.push(iGeometry);
}
return turf.featureCollection(countsArray);
}