mapbox / mapbox/tile-cover

Getting error when finding tile covers for extremely small polygons

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
196
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Here is the code snippet: https://jsfiddle.net/dfzaq1m2/ to request tile cover

It fails for both of these features:
- http://www.openstreetmap.org/way/490470366
- http://www.openstreetmap.org/way/490470364

Stack trace:
```
/Users/AmishaSingla/Documents/osm-compare/node_modules/tile-cover/index.js:229
if (ring && y === ring[0][1]) ring.pop();
^

TypeError: Cannot read property '1' of undefined
at lineCover (/Users/AmishaSingla/Documents/osm-compare/node_modules/tile-cover/index.js:229:30)
at polygonCover (/Users/AmishaSingla/Documents/osm-compare/node_modules/tile-cover/index.js:152:9)
at Object.getTiles [as tiles] (/Users/AmishaSingla/Documents/osm-compare/node_modules/tile-cover/index.js:77:9)
at feature_overlap (/Users/AmishaSingla/Documents/osm-compare/comparators/feature_overlap.js:111:19)
at /Users/AmishaSingla/Documents/osm-compare/tests/test_compare_function.js:23:3
at Array.forEach (native)
at Object. (/Users/AmishaSingla/Documents/osm-compare/tests/test_compare_function.js:22:19)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
```

cc @mourner

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

Reproduce the failure with the jsfiddle example and the two OpenStreetMap features, then trace tile-cover/index.js from getTiles through polygonCover and lineCover. Review comparators/feature_overlap.js and tests/test_compare_function.js for the calling and testing context. Done means extremely small polygons no longer throw and tile-cover returns a valid result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.