PageSourceSearch

https://turfjs.org/assets/js/3c5c1a28.b2a0ab0a.js

js turfjs.org collected 2026-09-24 09:17:47 UTC 9,182 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkturf_www||=[]).push([[13589],{83329(e,n,t){t.r(n),t.d(n,{Map0:()=>g,assets:()=>u,contentTitle:()=>p,default:()=>j,frontMatter:()=>h,metadata:()=>r,toc:()=>x});const r=JSON.parse('{"id":"api/center","title":"center","description":"{() => }","source":"@site/versioned_docs/version-6.5.0/api/center.mdx","sourceDirName":"api","slug":"/api/center","permalink":"/docs/6.5.0/api/center","draft":false,"unlisted":false,"editUrl":"https://github.com/Turfjs/turf-www/tree/master/versioned_docs/version-6.5.0/api/center.mdx","tags":[],"version":"6.5.0","frontMatter":{"title":"center"},"sidebar":"apiSidebar","previous":{"title":"bearing","permalink":"/docs/6.5.0/api/bearing"},"next":{"title":"centerOfMass","permalink":"/docs/6.5.0/api/centerOfMass"}}');var i=t(86070),s=t(67028),o=t(1045),a={};t.r(a),t.d(a,{along:()=>o.Qwm,angle:()=>o.g7h,applyFilter:()=>o.$hf,area:()=>o.Wcw,areaFactors:()=>o.i26,bbox:()=>o.Qk1,bboxClip:()=>o.ywB,bboxPolygon:()=>o.kJI,bearing:()=>o.dcc,bearingToAngle:()=>o.FDh,bearingToAzimuth:()=>o.u8E,bezier:()=>o.a7t,bezierSpline:()=>o.vKl,booleanClockwise:()=>o.D2R,booleanContains:()=>o.yxm,booleanCrosses:()=>o.hkq,booleanDisjoint:()=>o.t5S,booleanEqual:()=>o.x0k,booleanIntersects:()=>o.lgr,booleanOverlap:()=>o.cYD,booleanParallel:()=>o.Y5$,booleanPointInPolygon:()=>o.mFO,booleanPointOnLine:()=>o.O84,booleanWithin:()=>o.Cei,buffer:()=>o.ra8,center:()=>o.gXo,centerMean:()=>o.rb,centerMedian:()=>o.eZr,centerOfMass:()=>o.NAY,centroid:()=>o.vh2,circle:()=>o.n1W,cleanCoords:()=>o.ayX,clone:()=>o.o8B,clusterEach:()=>o.UZ0,clusterReduce:()=>o.HYf,clusters:()=>o.qf7,clustersDbscan:()=>o.Zqw,clustersKmeans:()=>o.pPd,collect:()=>o.Fod,collectionOf:()=>o.iww,combine:()=>o.kg7,concave:()=>o.Ms8,containsNumber:()=>o.lOq,convertArea:()=>o.vnt,convertDistance:()=>o.rCR,convertLength:()=>o.I3T,convex:()=>o.y5H,coordAll:()=>o.D3w,coordEach:()=>o.Fh1,coordReduce:()=>o.k7X,createBins:()=>o.f8u,degrees2radians:()=>o.md_,degreesToRadians:()=>o.tRv,destination:()=>o.j_,difference:()=>o.iv2,dissolve:()=>o.a1F,distance:()=>o.IoC,distanceToDegrees:()=>o.AD,distanceToRadians:()=>o.TQd,distanceWeight:()=>o.mJ,earthRadius:()=>o.zXD,ellipse:()=>o.pw2,envelope:()=>o.REH,explode:()=>o.Gdr,factors:()=>o.PgN,feature:()=>o.N4z,featureCollection:()=>o.Lrk,featureEach:()=>o.usj,featureOf:()=>o.mo4,featureReduce:()=>o.n4j,filterProperties:()=>o.qV7,findPoint:()=>o.Yd2,findSegment:()=>o.ptW,flatten:()=>o.Bqz,flattenEach:()=>o.iwz,flattenReduce:()=>o.VJK,flip:()=>o.UUz,geojsonType:()=>o.e8v,geomEach:()=>o.kX6,geomReduce:()=>o.jEc,geometry:()=>o.lCx,geometryCollection:()=>o.zbs,getCluster:()=>o.dB3,getCoord:()=>o.uGX,getCoords:()=>o.$Rn,getGeom:()=>o.bgk,getType:()=>o.Pwh,greatCircle:()=>o.Glg,helpers:()=>o._$r,hexGrid:()=>o.O9B,inside:()=>o.nxN,interpolate:()=>o.GWP,intersect:()=>o.y$5,invariant:()=>o.V1S,isNumber:()=>o.EtT,isObject:()=>o.Gvm,isobands:()=>o.Mii,isolines:()=>o.LNI,kinks:()=>o.nUT,length:()=>o.Bw9,lengthToDegrees:()=>o.vlv,lengthToRadians:()=>o.GfV,lineArc:()=>o.FsR,lineChunk:()=>o.W26,lineDistance:()=>o._kn,lineEach:()=>o.Iet,lineIntersect:()=>o.kVe,lineOffset:()=>o.uO7,lineOverlap:()=>o._Jg,lineReduce:()=>o.t0h,lineSegment:()=>o.wdR,lineSlice:()=>o.ne9,lineSliceAlong:()=>o.qMT,lineSplit:()=>o.JQ7,lineString:()=>o.wiw,lineStringToPolygon:()=>o.v4G,lineStrings:()=>o.Nls,lineToPolygon:()=>o.gP4,mask:()=>o.dKf,meta:()=>o.mIj,midpoint:()=>o.PVF,moranIndex:()=>o.KFB,multiLineString:()=>o.NUZ,multiPoint:()=>o.kBJ,multiPolygon:()=>o.g52,nearest:()=>o.pAw,nearestPoint:()=>o.xCI,nearestPointOnLine:()=>o.W1F,nearestPointToLine:()=>o.K9N,planepoint:()=>o.xYr,point:()=>o.zx7,pointGrid:()=>o.hq2,pointOnFeature:()=>o.QwJ,pointOnLine:()=>o.kWI,pointOnSurface:()=>o.rgS,pointToLineDistance:()=>o.d4V,points:()=>o.WRA,pointsWithinPolygon:()=>o.nj9,polygon:()=>o.n1,polygonSmooth:()=>o.bmV,polygonTangents:()=>o.v4M,polygonToLine:()=>o.CNZ,polygonToLineString:()=>o.HOm,polygonize:()=>o.Tz9,polygons:()=>o.qFD,projection:()=>o.Qju,propEach:()=>o.nPV,propReduce:()=>o.qBo,propertiesContainsFilter:()=>o.NLl,radians2degrees:()=>o.CVS,radiansToDegrees:()=>o.nv6,radiansToDistance:()=>o.tTZ,radiansToLength:()=>o.cJD,random:()=>o.yTv,randomLineString:()=>
1o.lWQ,randomPoint:()=>o._eC,randomPolygon:()=>o.myJ,randomPosition:()=>o.Dxs,rewind:()=>o.KrA,rhumbBearing:()=>o.Fc$,rhumbDestination:()=>o.rmV,rhumbDistance:()=>o.EUY,round:()=>o.LIG,sample:()=>o.XM1,sector:()=>o.rkH,segmentEach:()=>o.RPu,segmentReduce:()=>o.OQs,shortestPath:()=>o._6q,simplify:()=>o.CRN,square:()=>o.EwI,squareGrid:()=>o.cS4,standardDeviationalEllipse:()=>o.C0c,tag:()=>o.TcI,tesselate:()=>o.nYW,tin:()=>o.ucs,toMercator:()=>o.FU4,toWgs84:()=>o.zY8,transformRotate:()=>o.qS_,transformScale:()=>o.nIv,transformTranslate:()=>o.tLh,triangleGrid:()=>o.Vwd,truncate:()=>o.xvE,union:()=>o.KCZ,unitsFactors:()=>o.Ebk,unkinkPolygon:()=>o.BoU,validateBBox:()=>o.O6s,validateId:()=>o.GZo,voronoi:()=>o.B8d,within:()=>o.ux_});var l=t(36796),c=t(35876),d=t(25333);const h={title:"center"},p=void 0,u={};function g(){var e=o.WRA([[-97.522259,35.4691],[-97.502754,35.463455],[-97.508269,35.463245]]),n=o.gXo(e),t={features:e,center:n};return n.properties["marker-size"]="large",n.properties["marker-color"]="#000",(0,i.jsx)(l.A,{addToMap:t})}const x=[{value:"Description",id:"description",level:3},{value:"Parameters",id:"parameters",level:3},{value:"Returns",id:"returns",level:3},{value:"Examples",id:"examples",level:3},{value:"Installation",id:"installation",level:3}];function m(e){const n={a:"a",code:"code",em:"em",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.A,{children:()=>(0,i.jsx)(c.A,{turf:a})}),"\n",(0,i.jsx)(n.h3,{id:"description",children:"Description"}),"\n",(0,i.jsxs)(n.p,{children:["Takes a ",(0,i.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3.2",children:"Feature"})," or ",(0,i.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3.3",children:"FeatureCollection"})," and returns the absolute center point of all features."]}),"\n",(0,i.jsx)(n.h3,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.table,{children:[(0,i.jsx)(n.thead,{children:(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.th,{children:"Name"}),(0,i.jsx)(n.th,{children:"Type"}),(0,i.jsx)(n.th,{children:"Description"})]})}),(0,i.jsxs)(n.tbody,{children:[(0,i.jsxs)(n.tr,{children:[(0,i.jsx)(n.td,{children:"geojson"}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3",children:"GeoJSON"})})}),(0,i.jsx)(n.td,{children:"GeoJSON to be centered"})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:["options",(0,i.jsx)("i",{children:"?"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.strong,{children:"Object"})}),(0,i.jsxs)(n.td,{children:["Optional parameters ",(0,i.jsx)(n.em,{children:"(default {})"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:["options.properties",(0,i.jsx)("i",{children:"?"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.strong,{children:"Object"})}),(0,i.jsxs)(n.td,{children:["Translate GeoJSON Properties to Point ",(0,i.jsx)(n.em,{children:"(default {})"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:["options.bbox",(0,i.jsx)("i",{children:"?"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.strong,{children:"Object"})}),(0,i.jsxs)(n.td,{children:["Translate GeoJSON BBox to Point ",(0,i.jsx)(n.em,{children:"(default {})"})]})]}),(0,i.jsxs)(n.tr,{children:[(0,i.jsxs)(n.td,{children:["options.id",(0,i.jsx)("i",{children:"?"})]}),(0,i.jsx)(n.td,{children:(0,i.jsx)(n.strong,{children:"Object"})}),(0,i.jsxs)(n.td,{children:["Translate GeoJSON Id to Point ",(0,i.jsx)(n.em,{children:"(default {})"})]})]})]})]}),"\n",(0,i.jsx)(n.h3,{id:"returns",children:"Returns"}),"\n",(0,i.jsx)("ul",{children:(0,i.jsxs)(n.p,{children:[(0,i.jsxs)(n.strong,{children:[(0,i.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3.2",children:"Feature"}),"<",(0,i.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3.1.2",children:"Point"}),">"]})," a Point feature at the absolute center point of all input features"]})}),"\n",(0,i.jsx)(n.h3,{id:"examples",children:"Examples"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-javascript",children:"var features = turf.points([\n  [-97.522259, 35.4691],\n  [-97.502754, 35.463455],\n  [-97.508269, 35.463245],\n]);\n\nvar center = turf.center(features);\n"})}),"\n","\n",(0,i.jsx)(d.A,{children:()=>(0,i.jsx)(g,{})}),"\n",(0,i.jsx)(n.h3,{id:"installation",children:"Installation"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-javascript",children:'$ npm install @turf/center\n\nimport { center } from "@turf/center";\nconst result = center(...);\n'})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-javascript",children:'$ npm install @turf/turf\n\nimport * as turf from "@turf/turf";\nconst result = turf.center(...);\n'})})]})}function j(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.