Turf.jsHelper

turf.multiPoint

What is turf.multiPoint?

turf.multiPoint wraps an array of [lng, lat] positions into a single Feature<MultiPoint>. Unlike a FeatureCollection<Point>, every position in a MultiPoint shares one set of properties and is treated as one logical feature.

JavaScript
turf.multiPoint(coordinates, properties?, options?) → Feature<MultiPoint>

Options include:

  • bbox — bounding box [minX, minY, maxX, maxY]
  • id — identifier for the feature

When would you use turf.multiPoint?

Use turf.multiPoint when several coordinates belong to one record — for example the entrance and exit of a building, the stops along a single delivery route aggregated for analysis, or a cluster of sensor locations reporting under a shared id.

It is also a more compact representation than a FeatureCollection of Points when you want to render all positions with one paint layer and share one tooltip payload.

JavaScript
1const entrances = turf.multiPoint(
2  [[-122.42, 37.77], [-122.421, 37.771]],
3  { buildingId: 'B-102' }
4);

FAQs

How do I install Turf.js to use this function?

Install npm install @turf/helpers and import as import { multiPoint } from '@turf/helpers'. It is also exposed on @turf/turf as turf.multiPoint.

When should I choose MultiPoint over FeatureCollection of Points?

Choose MultiPoint when the points belong to one logical feature with shared properties. Choose a FeatureCollection of Points when each point carries distinct attributes (name, timestamp, category).

Can I flatten a MultiPoint into individual Point features?

Yes. Pass it through turf.flatten to get a FeatureCollection where every point is its own Feature, each inheriting the original properties.

Does turf.multiPoint accept a bbox option?

Yes. Pass { bbox: [minX, minY, maxX, maxY] } as the third argument. The bbox is stored on the Feature but is not auto-computed — use turf.bbox(feature) if you need it calculated.