Skip to content

@turf/buffer - buffer around a LineString has "hole" when buffer size is too big #2920

@felixonwheels

Description

@felixonwheels

I'm using turf.buffer() to compute a buffer around a GPX track that is converted to a GeoJson LineString.

I have issues with tracks that are small loops. Whenever I compute a buffer with a size inferior to 1km, it works as expected, but whenever the size is 2km or more, the resulted polygon gets a hole in it.

What am I doing wrong? Or is it be design?

Thank you!

Input LineString

{"type":"FeatureCollection","features":[
{"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[0.63883,43.17809],[0.6388,43.17823],[0.63877,43.17837],[0.6389,43.17846],[0.63887,43.17853],[0.63883,43.17856],[0.63864,43.17846],[0.63846,43.17835],[0.6384,43.17851],[0.63835,43.17866],[0.63829,43.17888],[0.63831,43.1791],[0.63833,43.17932],[0.63832,43.17948],[0.63831,43.17964],[0.63811,43.17978],[0.63792,43.17991],[0.63773,43.18004],[0.63761,43.18023],[0.6375,43.18042],[0.63738,43.18061],[0.63726,43.1808],[0.63715,43.18099],[0.63709,43.18117],[0.63703,43.18135],[0.63698,43.18152],[0.63679,43.18168],[0.6366,43.18184],[0.63642,43.18199],[0.63625,43.18205],[0.63608,43.18211],[0.63591,43.18218],[0.63573,43.18225],[0.63569,43.18241],[0.63564,43.18258],[0.6356,43.18274],[0.63544,43.18284],[0.63528,43.18295],[0.63509,43.18302],[0.6349,43.1831],[0.63472,43.18328],[0.6348,43.1834],[0.63487,43.18353],[0.63506,43.18371],[0.63529,43.18381],[0.63548,43.18382],[0.63568,43.18383],[0.63591,43.18396],[0.63601,43.18411],[0.63612,43.18427],[0.63623,43.18445],[0.63634,43.18463],[0.63645,43.18481],[0.63656,43.18499],[0.63672,43.18503],[0.63688,43.18507],[0.6371,43.18514],[0.63731,43.1852],[0.63753,43.18527],[0.63752,43.18544],[0.6375,43.18562],[0.63749,43.18579],[0.63755,43.1859],[0.63771,43.18602],[0.63788,43.18614],[0.63801,43.18605],[0.63804,43.18586],[0.63812,43.18575],[0.63821,43.18565],[0.63828,43.18553],[0.63835,43.18541],[0.63845,43.18526],[0.63855,43.18511],[0.63872,43.18499],[0.63888,43.18488],[0.63904,43.18477],[0.63921,43.18464],[0.63938,43.18452],[0.63956,43.18437],[0.63974,43.18422],[0.63991,43.18411],[0.64009,43.184],[0.64031,43.18401],[0.64053,43.18403],[0.6407,43.18396],[0.64087,43.1839],[0.64108,43.18397],[0.64129,43.18403],[0.6415,43.1841],[0.64161,43.18426],[0.64162,43.18428],[0.64174,43.18446],[0.64187,43.18464],[0.64204,43.18478],[0.64222,43.18493],[0.64245,43.18501],[0.64269,43.1851],[0.64292,43.18518],[0.64283,43.18532],[0.64274,43.18547],[0.64272,43.18566],[0.64271,43.18584],[0.64271,43.18602],[0.6427,43.18619],[0.64271,43.18632],[0.64284,43.18628],[0.64296,43.18612],[0.64307,43.18597],[0.64329,43.18587],[0.64351,43.18577],[0.64373,43.18568],[0.64399,43.18559],[0.64424,43.1855],[0.64449,43.18543],[0.64475,43.18536],[0.64501,43.18529],[0.6452,43.18522],[0.6454,43.18515],[0.64559,43.18507],[0.64581,43.18501],[0.64603,43.18495],[0.64626,43.18488],[0.64648,43.18482],[0.6467,43.18479],[0.64691,43.18476],[0.64713,43.18473],[0.64735,43.18471],[0.64757,43.1847],[0.64779,43.18468],[0.64807,43.18467],[0.64834,43.18465],[0.64849,43.18453],[0.64864,43.18442],[0.64884,43.18437],[0.64904,43.18433],[0.64913,43.18433],[0.64931,43.18442],[0.64949,43.1845],[0.64966,43.18438],[0.64982,43.1844],[0.64999,43.18442],[0.65008,43.18455],[0.65017,43.18468],[0.65038,43.18475],[0.65058,43.18481],[0.65079,43.18488],[0.65099,43.18498],[0.65119,43.18508],[0.6514,43.18518],[0.6516,43.18528],[0.65174,43.18543],[0.65187,43.18557],[0.65201,43.18571],[0.65208,43.18584],[0.65215,43.18597],[0.65222,43.18615],[0.65239,43.18619],[0.65252,43.18604],[0.65252,43.18604],[0.6527,43.18608],[0.65288,43.18612],[0.65307,43.18619],[0.65327,43.18626],[0.65336,43.18636],[0.65344,43.18646],[0.65341,43.18667],[0.65337,43.18688],[0.65351,43.18703],[0.65366,43.18719],[0.65386,43.18723],[0.65407,43.18727],[0.65427,43.18732],[0.65456,43.18739],[0.65485,43.18746],[0.65513,43.18754],[0.65542,43.18761],[0.65548,43.18772],[0.65554,43.18782],[0.65538,43.18799],[0.65522,43.18816],[0.65507,43.18827],[0.65491,43.18838],[0.65475,43.18849],[0.65458,43.18861],[0.65441,43.18873],[0.65424,43.18885],[0.65415,43.18896],[0.65407,43.18907],[0.65402,43.18921],[0.65397,43.18935],[0.65414,43.18943],[0.65431,43.18952],[0.65455,43.1896],[0.65481,43.18967],[0.65505,43.18965],[0.65528,43.18963],[0.65551,43.18962],[0.65575,43.1896],[0.65604,43.18955],[0.65633,43.18949],[0.65655,43.18946],[0.65676,43.18943],[0.65697,43.18939],[0.65719,43.18937],[0.65742,43.18935],[0.65771,43.18931],[0.65798,43.18934],[0.65824,43.18937],[0.65851,43.1894],[0.65867,43.18948],[0.65884,43.18957],[0.65901,43.18972],[0.65902,43.18993],[0.65895,43.19003],[0.65888,43.19014],[0.65915,43.1901],[0.65926,43.19001],[0.65934,43.1899],[0.65943,43.18979],[0.65961,43.18961],[0.6598,43.18943],[0.65998,43.18925],[0.66017,43.18907],[0.66035,43.1889],[0.66054,43.18872],[0.66072,43.18854],[0.6609,43.18836],[0.66109,43.18818],[0.66127,43.188],[0.66146,43.18782],[0.66171,43.18782],[0.66201,43.18783],[0.6623,43.18784],[0.66251,43.18782],[0.66272,43.1878],[0.66292,43.18773],[0.66312,43.18766],[0.66326,43.18761],[0.6634,43.18755],[0.66361,43.18741],[0.66382,43.18726],[0.66392,43.18711],[0.66398,43.18696],[0.66387,43.18691],[0.66376,43.1869],[0.66353,43.18679],[0.66335,43.1867],[0.66317,43.18661],[0.66296,43.18645],[0.66276,43.18637],[0.66266,43.18626],[0.66257,43.18615],[0.66243,43.18599],[0.66228,43.18583],[0.66206,43.18575],[0.66183,43.18566],[0.66171,43.18555],[0.66151,43.1855],[0.66131,43.18545],[0.66111,43.18531],[0.66091,43.18518],[0.66082,43.18513],[0.66055,43.18514],[0.66039,43.18515],[0.66023,43.18516],[0.65998,43.18516],[0.65973,43.18507],[0.65947,43.18505],[0.65926,43.18493],[0.65912,43.18494],[0.65884,43.18488],[0.65872,43.18479],[0.6586,43.18469],[0.65844,43.18469],[0.65827,43.18468],[0.65816,43.18463],[0.65808,43.1846],[0.65789,43.18451],[0.6577,43.18452],[0.65751,43.18452],[0.65736,43.18455],[0.65711,43.18458],[0.65687,43.1846],[0.65665,43.18464],[0.65643,43.18468],[0.65622,43.18468],[0.65602,43.18467],[0.65575,43.18462],[0.65569,43.18456],[0.65554,43.18461],[0.65533,43.18461],[0.65513,43.1846],[0.65501,43.1846],[0.65479,43.18451],[0.65456,43.18441],[0.65434,43.18432],[0.65413,43.18433],[0.65388,43.18427],[0.65377,43.1843],[0.65353,43.18424],[0.65334,43.18416],[0.65307,43.18413],[0.65285,43.18412],[0.65264,43.18408],[0.6524,43.18401],[0.65215,43.18398],[0.65201,43.18389],[0.65186,43.1838],[0.65172,43.18373],[0.65159,43.18367],[0.65136,43.18364],[0.65119,43.18358],[0.65102,43.18353],[0.65074,43.18347],[0.65046,43.1834],[0.65027,43.18331],[0.65007,43.18321],[0.64998,43.18313],[0.64989,43.18304],[0.64962,43.18294],[0.64938,43.18292],[0.64917,43.18287],[0.6491,43.1828],[0.64892,43.1828],[0.64875,43.18279],[0.64856,43.18272],[0.64831,43.18268],[0.64811,43.18275],[0.64797,43.18278],[0.64777,43.18275],[0.64763,43.1827],[0.64734,43.1827],[0.64707,43.18259],[0.64684,43.18251],[0.64661,43.18243],[0.64673,43.18223],[0.64685,43.18203],[0.64698,43.18184],[0.64714,43.18168],[0.64731,43.18152],[0.64747,43.18137],[0.64764,43.18121],[0.64777,43.18103],[0.6479,43.18085],[0.64803,43.18067],[0.64816,43.18048],[0.64828,43.1803],[0.6484,43.18015],[0.64852,43.18001],[0.64863,43.17986],[0.6487,43.17968],[0.64876,43.1795],[0.64882,43.17932],[0.64889,43.17914],[0.64903,43.17895],[0.64916,43.17875],[0.6493,43.17858],[0.64943,43.1784],[0.64957,43.17823],[0.64934,43.17815],[0.64911,43.17807],[0.64888,43.178],[0.64861,43.17793],[0.64834,43.17786],[0.64807,43.17779],[0.64781,43.17771],[0.64754,43.17764],[0.64727,43.17757],[0.647,43.1775],[0.64672,43.17743],[0.64644,43.17736],[0.64616,43.17728],[0.64588,43.17721],[0.6456,43.17714],[0.64531,43.17707],[0.64503,43.17699],[0.64475,43.17692],[0.64447,43.17685],[0.64419,43.17678],[0.64391,43.1767],[0.64363,43.17663],[0.64335,43.17656],[0.6431,43.1765],[0.64286,43.17645],[0.64258,43.17636],[0.6423,43.17628],[0.64207,43.17614],[0.64184,43.176],[0.6416,43.17587],[0.6414,43.17574],[0.64119,43.17561],[0.64106,43.17553],[0.64094,43.17544],[0.64067,43.17535],[0.6405,43.17529],[0.64028,43.17532],[0.64008,43.17531],[0.63988,43.1753],[0.63966,43.17531],[0.63945,43.17531],[0.63927,43.17539],[0.63909,43.17548],[0.63883,43.17556],[0.63872,43.17566],[0.63861,43.17575],[0.6385,43.17594],[0.63858,43.17611],[0.63859,43.17627],[0.63871,43.17644],[0.63872,43.17651],[0.63875,43.17656],[0.63892,43.1766],[0.63908,43.17664],[0.63916,43.1768],[0.63925,43.17696],[0.63934,43.17713],[0.63943,43.17729],[0.63932,43.17749],[0.63921,43.1777],[0.63909,43.17783],[0.63896,43.17796],[0.63883,43.17809]]}}
]}
Loading

GeoJson with a 1 km buffer

{"type":"FeatureCollection","features":[
{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[0.65489,43.1986],[0.65325,43.19859],[0.65036,43.19806],[0.65009,43.19798],[0.64933,43.19775],[0.64909,43.19767],[0.64745,43.19699],[0.64728,43.19691],[0.64711,43.19682],[0.64515,43.19564],[0.64464,43.19517],[0.64289,43.19531],[0.64055,43.19517],[0.63977,43.19501],[0.63958,43.19505],[0.63726,43.19512],[0.63497,43.19488],[0.63278,43.19433],[0.63077,43.19349],[0.62901,43.19239],[0.62885,43.19227],[0.62869,43.19215],[0.62738,43.19098],[0.62727,43.19084],[0.62651,43.19021],[0.6264,43.19006],[0.62552,43.1894],[0.62533,43.18923],[0.62352,43.18704],[0.62344,43.18692],[0.62337,43.18679],[0.62262,43.185],[0.62239,43.18315],[0.62269,43.1813],[0.62351,43.17953],[0.6248,43.17793],[0.62499,43.17775],[0.62539,43.17743],[0.62576,43.17695],[0.62625,43.17657],[0.62618,43.17564],[0.62645,43.17403],[0.62712,43.17248],[0.62722,43.17229],[0.62817,43.17096],[0.62941,43.16976],[0.62953,43.16966],[0.62964,43.16957],[0.63156,43.1683],[0.63229,43.168],[0.63228,43.16798],[0.63247,43.16789],[0.63265,43.16781],[0.63348,43.16749],[0.63381,43.16735],[0.63406,43.16727],[0.63406,43.16727],[0.63496,43.16693],[0.63748,43.16643],[0.63877,43.16638],[0.63876,43.16635],[0.63898,43.16633],[0.64007,43.16633],[0.64008,43.16633],[0.64009,43.16633],[0.64053,43.16632],[0.64055,43.16632],[0.64092,43.16631],[0.64316,43.16651],[0.64531,43.16701],[0.64548,43.16707],[0.64591,43.16721],[0.64618,43.1673],[0.64786,43.168],[0.64843,43.16833],[0.64859,43.16837],[0.64887,43.16844],[0.64915,43.16852],[0.64944,43.16859],[0.64972,43.16866],[0.64999,43.16873],[0.65027,43.16881],[0.65056,43.16888],[0.65084,43.16895],[0.65112,43.16902],[0.6512,43.16904],[0.65146,43.16912],[0.65173,43.16919],[0.652,43.16926],[0.65227,43.16933],[0.65254,43.1694],[0.65281,43.16947],[0.65308,43.16954],[0.65404,43.16983],[0.65427,43.16991],[0.6545,43.16999],[0.65473,43.17006],[0.65692,43.17101],[0.65879,43.17226],[0.66027,43.17376],[0.6613,43.17545],[0.66144,43.17594],[0.66219,43.17608],[0.66264,43.17624],[0.66264,43.17624],[0.66273,43.17624],[0.6653,43.17675],[0.66766,43.17765],[0.66776,43.1777],[0.66796,43.17781],[0.66869,43.17819],[0.66971,43.17865],[0.67129,43.17969],[0.67149,43.17987],[0.67216,43.18023],[0.67371,43.18143],[0.67493,43.18282],[0.67578,43.18435],[0.67624,43.18597],[0.67628,43.18762],[0.67591,43.18925],[0.67585,43.18939],[0.67496,43.19113],[0.67485,43.19129],[0.67373,43.19262],[0.67231,43.19379],[0.6721,43.19393],[0.67189,43.19408],[0.66924,43.19547],[0.66911,43.19553],[0.66897,43.19558],[0.66888,43.19561],[0.66874,43.19576],[0.66863,43.19586],[0.66711,43.19698],[0.66534,43.19789],[0.66337,43.19855],[0.66128,43.19896],[0.66101,43.199],[0.65854,43.19913],[0.65609,43.1989],[0.65489,43.1986]]]}}
]}
Loading

GeoJson with a 2 km buffer

{"type":"FeatureCollection","features":[
{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[0.67974,43.17318],[0.68033,43.17349],[0.68343,43.1759],[0.68588,43.17868],[0.68758,43.18174],[0.6885,43.18497],[0.68858,43.18827],[0.68784,43.19153],[0.68778,43.19168],[0.68599,43.19515],[0.68589,43.19531],[0.68364,43.19797],[0.6808,43.20031],[0.68059,43.20046],[0.68038,43.2006],[0.6772,43.20228],[0.67506,43.20385],[0.67152,43.20567],[0.6676,43.207],[0.66342,43.20782],[0.66314,43.20785],[0.65821,43.20812],[0.65331,43.20766],[0.65273,43.20752],[0.65167,43.20751],[0.6459,43.20644],[0.64563,43.20637],[0.64411,43.2059],[0.64387,43.20581],[0.64059,43.20447],[0.64024,43.2043],[0.63995,43.20412],[0.63861,43.20404],[0.63665,43.2041],[0.63206,43.20362],[0.62768,43.20252],[0.62366,43.20084],[0.62014,43.19864],[0.61982,43.1984],[0.6172,43.19606],[0.61715,43.19599],[0.61705,43.19591],[0.61597,43.1951],[0.61578,43.19492],[0.61216,43.19055],[0.61201,43.1903],[0.61051,43.18673],[0.61006,43.18302],[0.61066,43.17932],[0.61229,43.17579],[0.61417,43.17347],[0.6144,43.17212],[0.61573,43.16902],[0.61584,43.16883],[0.61774,43.16617],[0.62022,43.16376],[0.62034,43.16367],[0.62045,43.16357],[0.62331,43.16159],[0.62656,43.15996],[0.62718,43.15971],[0.63096,43.15842],[0.63499,43.15762],[0.63914,43.15732],[0.63957,43.15732],[0.64119,43.15734],[0.64139,43.15735],[0.64138,43.15743],[0.64478,43.15758],[0.65012,43.15873],[0.65029,43.15879],[0.65115,43.15907],[0.65141,43.15916],[0.65399,43.16023],[0.65411,43.16026],[0.65439,43.16033],[0.65467,43.1604],[0.65495,43.16047],[0.65523,43.16055],[0.65539,43.16059],[0.65566,43.16066],[0.65593,43.16073],[0.65619,43.1608],[0.65647,43.16087],[0.65674,43.16094],[0.657,43.16101],[0.65727,43.16109],[0.6592,43.16166],[0.65943,43.16174],[0.65967,43.16182],[0.6599,43.1619],[0.66426,43.16378],[0.66801,43.16629],[0.67023,43.16854],[0.67292,43.16957],[0.67295,43.16953],[0.67354,43.16977],[0.67381,43.1699],[0.67451,43.17017],[0.6746,43.17021],[0.67537,43.17066],[0.67713,43.17147],[0.67974,43.17318]],[[0.64242,43.17942],[0.64129,43.18066],[0.64681,43.18989],[0.6549,43.18601],[0.65513,43.18297],[0.64242,43.17942]]]}}
]}
Loading

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions