mapbox / tile-cover

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

fix crash for max zoom 12 or more #86

Open aharonamir opened 4 years ago

aharonamir commented 4 years ago

When selecting max_zoom of 12 or more we get odd number of intersections, which causes exception when trying to read index i+1 which is out of the array bounds

morganherlocker commented 4 years ago

Do you have a test case for this @aharonamir? I have never had issues with max_zoom >= 12 myself, so I'm wondering if there is a geometry issue at play here?

aharonamir commented 4 years ago

var poly = JSON.parse(fs.readFileSync(config.file)); var limits = { min_zoom: 10, // or 12 max_zoom: 12 }; const tiles = cover.tiles(poly.geometry, limits); The File:

fremont-geojson.json.zip