hotosm / osm-export-tool

Web service to download customised OSM data in various file formats
http://export.hotosm.org/
BSD 3-Clause "New" or "Revised" License
145 stars 45 forks source link

Zoom range option for MBTiles only exports a single zoom layer #371

Open simonw opened 3 years ago

simonw commented 3 years ago

Here's my export: https://export.hotosm.org/en/v3/exports/f269d67d-d273-4c41-97a1-360800a544e4

I requested zoom layers 5-17, using the range slider like this:

HOT_Export_Tool

But the export has just a single tile from level 5 and 3,630 at level 17 - but no tiles at all for the zoom levels in between:

% sqlite3 San_Francisco.mbtiles 'select zoom_level, count(*) from tiles group by zoom_level'
5|1
17|3630

I was expecting to get a database with tiles at every zoom level between 5 and 17.

simonw commented 3 years ago

I think the bug may be here: https://github.com/hotosm/osm-export-tool-python/blob/8e4165a454303abbea2bd18cf5ffcdd5b9d0370d/osm_export_tool/nontabular.py#L103-L108

def mbtiles(geom,filepath,tiles_url,minzoom,maxzoom):
    mb = landez.MBTilesBuilder(cache=False,tiles_url=tiles_url,tiles_headers={'User-Agent':'github.com/hotosm/osm-export-tool'},filepath=filepath)
    mb.add_coverage(bbox=geom.bounds,
                    zoomlevels=[minzoom,maxzoom])
    mb.run()
    return [File('mbtiles',[filepath],{'minzoom':minzoom,'maxzoom':maxzoom,'source':tiles_url})]

Should that be this instead?

    mb.add_coverage(bbox=geom.bounds,
                    zoomlevels=list(range(minzoom, maxzoom + 1))
jvolker commented 3 years ago

I am having the same issue.