Cells

aggregateIntoCells groups your points into cells, a grid of hexagons or squares or your own polygons, and gives each cell statistics over a value of its points, such as the median price per square metre. It needs no map, so it runs in Node.js too.

aggregateIntoCells

import { aggregateIntoCells } from '@tomtom-org/maps-sdk/core';
const cells = aggregateIntoCells(listings, {
grid: 'hex',
cellSizeKM: 1,
value: 'pricePerSquareMeter',
stats: ['median', 'count'],
minCount: 5,
});
// cells.features[0].properties: { median, count }
  • Returns a polygon FeatureCollection with one feature per cell holding at least minCount points, the statistics as its properties.
  • To draw the cells, pass them to any map module. Aggregating points into areas lists every option and draws them with CustomGeoJSONModule.