mapbox/mercantile

mercantile.bounding_tile returns low zoom levels around specific lat/lng values

felixink opened this issue · 3 comments

Example for longitudes spanning between -90°W:

$ echo '[-90.00118153266015, 34.84103366571037, -89.99767703849322, 34.845246976595064]' | mercantile bounding-tile
[0, 0, 1]

Example for latitudes spanning between 40°N:

$ echo '[-91.17230144314497, 40.845538860256326, -91.14938242919534, 41.02241706305357]' | mercantile bounding-tile
[0, 1, 2]

@felixink This looks right to me -- the first example spans two zoom 2 tiles, so the bounding tile is the parent zoom level tile [0, 0, 1]

image

http://geojson.io/#id=gist:dnomadb/cc25d6c88be166e6d372933dc337dc6f&map=16/34.8462/-89.9988

Whereas in the second example this bounds is within a single zoom 2 tile:
image

But crosses the bounds of zoom 3 tiles (why zoom 2 was selected):
image

Got it, mistake on my part. Closing the issue now.

Thanks @dnomadb !