turf.truncate without rounding
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
I would like to compare two GeoJSON Features to find out if they are very similar. I use truncate and then compare the geometry. The problem is, that truncate not just cuts the values at the specified decimal but also rounds.
As an example the values 48.022774 and 48.022775 when truncated to 5 decimals lead to 48.02277 and 48.02278.
Is there a way to disable rouding when using truncate?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the turf.truncate entry point and inspect how the requested decimal precision is applied. Determine how a no-rounding option should be exposed, then verify that values such as 48.022774 and 48.022775 remain truncated rather than rounded when comparing GeoJSON geometries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100