Skip to content

Commit

Permalink
metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocudini committed Sep 6, 2023
1 parent 7005392 commit fac4b30
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,20 +237,20 @@ function getMetadata(data) {

const bb = turf.bbox(data)
, [minLon, minLat, maxLon, maxLat] = bb.map(c => setPrec(c))
, bbox = {minLon, minLat, maxLon, maxLat};

const len = turf.length(data, opts)
, length = Number(len.toFixed(2));

const cen = turf.centroid(data)
, bbox = {minLon, minLat, maxLon, maxLat}
//
, len = turf.length(data, opts)
, length = Number(len.toFixed(2))
//
, cen = turf.centroid(data)
, centroid = locPrec(cen.geometry.coordinates)

const along = turf.along(data, len/2, opts)
//
, along = turf.along(data, len/2, opts)
, middlepoint = locPrec(along.geometry.coordinates)

const coords = data.coordinates || data.geometry.coordinates
//
, coords = data.coordinates || data.geometry.coordinates
, bearing = turf.bearing(coords[0], coords.at(-1))
, direction = Number(bearing.toFixed(2))
, direction = Number(bearing.toFixed(2));

meta = {
length,
Expand Down

0 comments on commit fac4b30

Please sign in to comment.