mapbox / mbtiles-extracts

Extract parts of MBTiles into separate files using a GeoJSON with polygons.
ISC License
52 stars 13 forks source link

Tile center does not lie within a polygon sometimes #12

Closed arunasank closed 5 years ago

arunasank commented 5 years ago

The mbtiles-extracts library checks to see if a tile center lies within a geojson polygon using the which-polygon library.

However, there are times when the tile center does not lie within the geojson polygon, even though parts of the polygon are present in the tile as seen in the diagram below:

Solution

Check if the tile bounding box intersects with the polygon to extract a tile as explained in https://github.com/mapbox/mbtiles-extracts/issues/10#issuecomment-437370452

cc/ @mourner @answerquest

mourner commented 5 years ago

Fixed by #14