1"use strict";(globalThis.webpackChunkturf_www||=[]).push([[558],{57674(e,n,t){t.r(n),t.d(n,{Map0:()=>x,assets:()=>f,contentTitle:()=>u,default:()=>b,frontMatter:()=>m,metadata:()=>r,toc:()=>j});const r=JSON.parse('{"id":"api/transformTranslate","title":"transformTranslate","description":"Description","source":"@site/docs/api/transformTranslate.mdx","sourceDirName":"api","slug":"/api/transformTranslate","permalink":"/docs/next/api/transformTranslate","draft":false,"unlisted":false,"editUrl":"https://github.com/Turfjs/turf-www/tree/master/docs/api/transformTranslate.mdx","tags":[],"version":"current","frontMatter":{"title":"transformTranslate"},"sidebar":"apiSidebar","previous":{"title":"transformScale","permalink":"/docs/next/api/transformScale"},"next":{"title":"union","permalink":"/docs/next/api/union"}}');var s=t(86070),o=t(67028),i=t(15388),a=t(49020),l=t(64776),c={};t.r(c),t.d(c,{along:()=>l.Qwm,angle:()=>l.g7h,applyFilter:()=>l.$hf,area:()=>l.Wcw,areaFactors:()=>l.i26,azimuthToBearing:()=>l.Oe8,bbox:()=>l.Qk1,bboxClip:()=>l.ywB,bboxPolygon:()=>l.kJI,bearing:()=>l.dcc,bearingToAzimuth:()=>l.u8E,bezierSpline:()=>l.vKl,booleanClockwise:()=>l.D2R,booleanConcave:()=>l.U7O,booleanContains:()=>l.yxm,booleanCrosses:()=>l.hkq,booleanDisjoint:()=>l.t5S,booleanEqual:()=>l.x0k,booleanIntersects:()=>l.lgr,booleanOverlap:()=>l.cYD,booleanParallel:()=>l.Y5$,booleanPointInPolygon:()=>l.mFO,booleanPointOnLine:()=>l.O84,booleanTouches:()=>l.UsQ,booleanValid:()=>l.hxF,booleanWithin:()=>l.Cei,buffer:()=>l.ra8,center:()=>l.gXo,centerMean:()=>l.rb,centerMedian:()=>l.eZr,centerOfMass:()=>l.NAY,centroid:()=>l.vh2,circle:()=>l.n1W,cleanCoords:()=>l.ayX,clone:()=>l.o8B,cloneProperties:()=>l.Rdw,clusterEach:()=>l.UZ0,clusterReduce:()=>l.HYf,clusters:()=>l.qf7,clustersDbscan:()=>l.Zqw,clustersKmeans:()=>l.pPd,collect:()=>l.Fod,collectionOf:()=>l.iww,combine:()=>l.kg7,concave:()=>l.Ms8,containsNumber:()=>l.lOq,convertArea:()=>l.vnt,convertLength:()=>l.I3T,convex:()=>l.y5H,coordAll:()=>l.D3w,coordEach:()=>l.Fh1,coordReduce:()=>l.k7X,createBins:()=>l.f8u,degreesToRadians:()=>l.tRv,destination:()=>l.j_,difference:()=>l.iv2,directionalMean:()=>l.eFb,dissolve:()=>l.a1F,distance:()=>l.IoC,distanceWeight:()=>l.mJ,earthRadius:()=>l.zXD,ellipse:()=>l.pw2,envelope:()=>l.REH,explode:()=>l.Gdr,factors:()=>l.PgN,feature:()=>l.N4z,featureCollection:()=>l.Lrk,featureEach:()=>l.usj,featureOf:()=>l.mo4,featureReduce:()=>l.n4j,filterProperties:()=>l.qV7,findPoint:()=>l.Yd2,findSegment:()=>l.ptW,flatten:()=>l.Bqz,flattenEach:()=>l.iwz,flattenReduce:()=>l.VJK,flip:()=>l.UUz,geojsonRbush:()=>l.sZS,geojsonType:()=>l.e8v,geomEach:()=>l.kX6,geomReduce:()=>l.jEc,geometry:()=>l.lCx,geometryCollection:()=>l.zbs,getCluster:()=>l.dB3,getCoord:()=>l.uGX,getCoords:()=>l.$Rn,getGeom:()=>l.bgk,getType:()=>l.Pwh,greatCircle:()=>l.Glg,helpers:()=>l._$r,hexGrid:()=>l.O9B,interpolate:()=>l.GWP,intersect:()=>l.y$5,invariant:()=>l.V1S,isNumber:()=>l.EtT,isObject:()=>l.Gvm,isobands:()=>l.Mii,isolines:()=>l.LNI,kinks:()=>l.nUT,length:()=>l.Bw9,lengthToDegrees:()=>l.vlv,lengthToRadians:()=>l.GfV,lineArc:()=>l.FsR,lineChunk:()=>l.W26,lineEach:()=>l.Iet,lineIntersect:()=>l.kVe,lineOffset:()=>l.uO7,lineOverlap:()=>l._Jg,lineReduce:()=>l.t0h,lineSegment:()=>l.wdR,lineSlice:()=>l.ne9,lineSliceAlong:()=>l.qMT,lineSplit:()=>l.JQ7,lineString:()=>l.wiw,lineStrings:()=>l.Nls,lineToPolygon:()=>l.gP4,mask:()=>l.dKf,meta:()=>l.mIj,midpoint:()=>l.PVF,moranIndex:()=>l.KFB,multiLineString:()=>l.NUZ,multiPoint:()=>l.kBJ,multiPolygon:()=>l.g52,nearestNeighborAnalysis:()=>l.rBB,nearestPoint:()=>l.xCI,nearestPointOnLine:()=>l.W1F,nearestPointToLine:()=>l.K9N,planepoint:()=>l.xYr,point:()=>l.zx7,pointGrid:()=>l.hq2,pointOnFeature:()=>l.QwJ,pointToLineDistance:()=>l.d4V,pointToPolygonDistance:()=>l.fJX,points:()=>l.WRA,pointsWithinPolygon:()=>l.nj9,polygon:()=>l.n1,polygonSmooth:()=>l.bmV,polygonTangents:()=>l.v4M,polygonToLine:()=>l.CNZ,polygonize:()=>l.Tz9,polygons:()=>l.qFD,projection:()=>l.Qju,propEach:()=>l.nPV,propReduce:()=>l.qBo,propertiesContainsFilter:()=>l.NLl,quadratAnalysis:()=>l.txz,radiansToDegrees:()=>l.nv6,radiansToLength:()=>l.cJD,random:()=>l.yTv,randomLineString:()=>l.lWQ,randomPoint:()=>l._eC,randomPolygon:()=>l.myJ,randomPosition:()=>l.Dxs,rectangleGrid:()=>l.K1I,rewind:()=>l.KrA,rhumbBearing:()=>
1l.Fc$,rhumbDestination:()=>l.rmV,rhumbDistance:()=>l.EUY,round:()=>l.LIG,sample:()=>l.XM1,sector:()=>l.rkH,segmentEach:()=>l.RPu,segmentReduce:()=>l.OQs,shortestPath:()=>l._6q,simplify:()=>l.CRN,square:()=>l.EwI,squareGrid:()=>l.cS4,standardDeviationalEllipse:()=>l.C0c,tag:()=>l.TcI,tesselate:()=>l.nYW,tin:()=>l.ucs,toMercator:()=>l.FU4,toWgs84:()=>l.zY8,transformRotate:()=>l.qS_,transformScale:()=>l.nIv,transformTranslate:()=>l.tLh,triangleGrid:()=>l.Vwd,truncate:()=>l.xvE,union:()=>l.KCZ,unkinkPolygon:()=>l.BoU,validateBBox:()=>l.O6s,validateId:()=>l.GZo,voronoi:()=>l.B8d});var d=t(36796),h=t(35876),p=t(25333);const m={title:"transformTranslate"},u=void 0,f={};function x(){var e=i.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]),n=a.t(e,100,35),t={poly:e,translatedPoly:n};return n.properties={stroke:"#F00","stroke-width":4},(0,s.jsx)(d.A,{addToMap:t})}const j=[{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 g(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,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h3,{id:"description",children:"Description"}),"\n",(0,s.jsx)(n.p,{children:"Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line\non the provided direction angle."}),"\n",(0,s.jsx)(n.p,{children:"Note that this moves the points of your shape individually and can therefore change\nthe overall shape. How noticable this is depends on the distance and the used projection."}),"\n",(0,s.jsx)(n.h3,{id:"parameters",children:"Parameters"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Name"}),(0,s.jsx)(n.th,{children:"Type"}),(0,s.jsx)(n.th,{children:"Description"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"geojson"}),(0,s.jsx)(n.td,{children:(0,s.jsxs)(n.strong,{children:[(0,s.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3",children:"GeoJSON"})," | ",(0,s.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3.1.8",children:"GeometryCollection"})]})}),(0,s.jsx)(n.td,{children:"object to be translated"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"distance"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number",children:"number"})})}),(0,s.jsx)(n.td,{children:"length of the motion; negative values determine motion in opposite direction"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"direction"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number",children:"number"})})}),(0,s.jsx)(n.td,{children:"of the motion; angle from North in decimal degrees, positive clockwise"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:["options",(0,s.jsx)("i",{children:"?"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object",children:"Object"})})}),(0,s.jsxs)(n.td,{children:["Optional parameters ",(0,s.jsx)(n.em,{children:"(default {})"})]})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:["options.units",(0,s.jsx)("i",{children:"?"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.a,{href:"/docs/next/api/types/Units",children:"Units"})})}),(0,s.jsxs)(n.td,{children:["in which ",(0,s.jsx)(n.code,{children:"distance"})," will be expressed; Supports all valid Turf ",(0,s.jsx)(n.a,{href:"https://turfjs.org/docs/api/types/Units",children:"Units"})," ",(0,s.jsx)(n.em,{children:"(default 'kilometers')"})]})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:["options.zTranslation",(0,s.jsx)("i",{children:"?"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number",children:"number"})})}),(0,s.jsxs)(n.td,{children:["length of the vertical motion, same unit of distance ",(0,s.jsx)(n.em,{children:"(default 0)"})]})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsxs)(n.td,{children:["options.mutate",(0,s.jsx)("i",{children:"?"})]}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.a,{href:"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean",children:"boolean"})})}),(0,s.jsxs)(n.td,{children:["allows GeoJSON input to be mutated (significant performance increase if true) ",(0,s.jsx)(n.em,{children:"(default false)"})]})]})]})]}),"\n",(0,s.jsx)(n.h3,{id:"returns",children:"Returns"}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsxs)(n.strong,{children:[(0,s.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3",children:"GeoJSON"})," | ",(0,s.jsx)(n.a,{href:"https://tools.ietf.org/html/rfc7946#section-3.1.8",children:"GeometryCollection"})]})," the translated GeoJSON object"]}),"\n",(0,s.jsx)(n.h3,{id:"examples",children:"Examples"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-javascript",children:"var poly = turf.polygon([\n [\n [0, 29],\n [3.5, 29],\n [2.5, 32],\n [0, 29],\n ],\n]);\nvar translatedPoly = turf.transformTranslate(poly, 100, 35);\n"})}),"\n",(0,s.jsx)(p.A,{children:()=>(0,s.jsx)(x,{})}),"\n",(0,s.jsx)(n.h3,{id:"installation",children:"Installation"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-javascript",children:'$ npm install @turf/transform-translate\n\nimport { transformTranslate } from "@turf/transform-translate";\nconst result = transformTranslate(...);\n'})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-javascript",children:'$ npm install @turf/turf\n\nimport * as turf from "@turf/turf";\nconst result = turf.transformTranslate(...);\n'})}),"\n",(0,s.jsx)(p.A,{children:()=>(0,s.jsx)(h.A,{turf:c})})]})}function b(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(g,{...e})}):g(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.