turf.area
What is turf.area?
turf.area takes any GeoJSON Feature, FeatureCollection, or Geometry containing polygons and returns the total area in square meters. It uses a geodesic calculation on the WGS84 ellipsoid based on Robert. G. Chamberlain and William H. Duquette's formula, so results reflect true surface area and do not depend on the map projection used for display.
turf.area(geojson) → numberThere are no options — the return value is always square meters. Convert to other units with turf.convertArea.
When would you use turf.area?
Use turf.area to display real-time polygon area as a user draws a selection on a MapLibre or Mapbox map — for example, letting a farmer sketch a field and seeing the hectares update live. It is also ideal for Node.js ETL scripts that compute parcel sizes, lot coverage, or watershed areas before loading results into PostGIS or a data warehouse.
Because it handles FeatureCollection inputs and sums across features, it is efficient for validating user-drawn boundaries, aggregating land-use totals by category, or quickly rejecting shapes that fall outside expected acreage bounds in an intake form.
undefinedFAQs
What units does turf.area return?
Always square meters. There is no units option. To convert, divide by 10,000 for hectares, by 1,000,000 for square kilometers, or use turf.convertArea(value, 'meters', 'acres') for imperial units.
How accurate is it compared to PostGIS ST_Area?
turf.area uses the same geodesic formula family and typically matches ST_Area(geography) within a fraction of a percent. For very small polygons (a few square meters) or polygons spanning the antimeridian, validate with turf.cleanCoords first — malformed rings can produce wildly wrong results.
Can I install just area without the full Turf bundle?
Yes. Use npm install @turf/area for a minimal dependency footprint. The scoped package imports only the helpers it needs, which tree-shakes cleanly in Vite, Rollup, Webpack 5, and esbuild.
Does it handle holes (inner rings) correctly?
Yes. turf.area subtracts the area of interior rings from exterior rings per the GeoJSON spec. Make sure your polygons follow the right-hand rule (exterior ring counter-clockwise, holes clockwise). If unsure, call turf.rewind(feature) first.