turf.explode
What is turf.explode?
turf.explode takes any GeoJSON input and returns a FeatureCollection<Point> — one Point Feature per coordinate. It is the canonical way to get every vertex of a complex feature as standalone points for further processing.
turf.explode(geojson) → FeatureCollection<Point>When would you use turf.explode?
Use turf.explode when you need vertex-level access — for example, to run turf.nearestPoint against the corners of a polygon, to style every vertex with a marker layer on MapLibre, or to build a hit-target cloud for vertex-editing UI in a draw tool.
In Node.js, it is useful for pre-processing before vertex-level analytics (density, nearest-neighbour histograms) or for converting a route line into a point cloud for elevation lookups.
undefinedFAQs
Does the output include duplicate closing vertices on rings?
Yes — polygon rings are stored with a duplicate first/last coordinate per GeoJSON spec, and turf.explode emits all vertices. If you want unique positions only, deduplicate after exploding with a Set keyed on coordinate strings.
How do I install just explode?
npm install @turf/explode. It depends on @turf/meta and @turf/helpers and is small.
Does each exploded point inherit the source feature's properties?
Yes — by default each exploded point carries the parent feature's properties. If you had custom per-vertex data it is not preserved.
How is it different from turf.flatten?
turf.flatten splits multi-geometries into individual features of the same geometry type. turf.explode decomposes everything to points — vertex level, not feature level.