Turfjs / Turfjs/turf

Projection problem with buffer function

Open
#2,379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/buffer
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

I use @turf/turf 6.5.0.

Features of the screenshot :

{
  type: 'Feature',
  geometry: { type: 'LineString', coordinates: Array.from({ length: 27 }, (_, i) => [20, i * 5 - 65]) },
  properties: {}
},
...Array.from({ length: 27 }, (_, i) => ({ type: 'Feature', geometry: { type: 'Point', coordinates: [0, i * 5 - 65] } as GeometryPoint, properties: {} } as GeoJsonFeature<GeometryPoint>))

When I create a 140 miles buffer with the turf buffer function, here's what happened :

image

(For rendering the map, I use OpenLayer 7.1.0 in projection EPSG:4326)

The buffer of each point is correct, but every time I try to buffering an other king of Geometry, such as LineString or Polygon, the buffer is not correct : it doesn't respect the projection and the distances.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Turf's buffer function and reproduce the reported result with the supplied LineString, Point features, 140-mile distance, and EPSG:4326 context. Compare the LineString and Polygon outputs with the point buffers, then define done as distances and geometry respecting the intended projection, with regression coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.