mapbox / tile-cover

Generate the minimum number of tiles to cover a geojson geometry
MIT License
189 stars 40 forks source link

Getting error when finding tile covers for extremely small polygons #78

Open amishas157 opened 7 years ago

amishas157 commented 7 years ago

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

It fails for both of these features:

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.<anonymous> (/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