turf.point
What is turf.point?
turf.point is the most-used constructor in Turf.js. It wraps a [lng, lat] (or [lng, lat, elevation]) position into a valid Feature<Point> with optional properties.
turf.point(coordinates, properties?, options?) → Feature<Point>Options include:
bbox— bounding box[minX, minY, maxX, maxY]id— identifier for the feature
When would you use turf.point?
Use turf.point whenever you need to turn raw coordinate pairs — from a geocoder response, a GPS device, a form input, or a database row — into GeoJSON so you can pass them to another Turf function (turf.distance, turf.buffer, turf.nearestPoint) or hand them to MapLibre/Mapbox as a source.
It is also the canonical way to build test fixtures and to represent a clicked map location in an interactive app.
1map.on('click', e => {
2 const clicked = turf.point([e.lngLat.lng, e.lngLat.lat], { clickedAt: Date.now() });
3 const radius = turf.buffer(clicked, 500, { units: 'meters' });
4 source.setData(radius);
5});FAQs
How do I install Turf.js to use this function?
Install the helpers package for tree-shaking: npm install @turf/helpers, then import { point } from '@turf/helpers'. The full bundle @turf/turf also exposes it as turf.point.
Does turf.point accept latitude-first coordinates?
No. GeoJSON — and therefore Turf — requires [longitude, latitude] order. Mixing this up is one of the most common bugs; events from Leaflet or MapLibre provide .lng and .lat separately, so be explicit when constructing coordinates.
Can I include elevation or a third coordinate value?
Yes. GeoJSON allows a third value per position (typically altitude in metres). turf.point([-122.42, 37.77, 52]) is valid and some functions (like turf.planepoint) use the z-value.
How do I build many points efficiently?
Call turf.point in a loop or map, then pass the array to turf.featureCollection. For very large datasets, consider skipping the helper and constructing the GeoJSON literal directly — turf.point's property copying adds minor overhead in tight loops.