我正在使用Nutiteq SDK开发一个Android地图应用,需要脱机工作并显示一个小城市的地图,所以我正在使用.mbtiles文件。到目前为止,使用TileMill下载的.mbtile文件工作得很好,或者更确切地说是他们的一个演示项目,因为互联网访问对我来说有时是个大问题,因为同样的原因,当我的一个朋友告诉我他写了一篇文章时,这听起来很棒用于从tiles .png文件夹创建.mbtiles文件的Python脚本,具有完全.mbtiles格式。我尝试使用以这种方式获得的文件,并在加载文件时出现以下错误:
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer: Start loading zoom=10 x=277 y=444
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer: Start loading zoom=10 x=278 y=444
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer: Start loading zoom=10 x=277 y=443
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer: Start loading zoom=10 x=278 y=443
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer: Start loading zoom=10 x=277 y=445
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer: Start loading zoom=10 x=278 y=445
10-02 00:11:41.976: DEBUG/hellomap(404): DbMapLayer task: Start loading zoom=10 x=277 y=444
10-02 00:11:42.340: DEBUG/TileDatabaseHelper(404): not found z=10 x=277 y=579
10-02 00:11:42.340: ERROR/hellomap(404): com.nutiteq.layers.raster.MBTilesMapLayer$DbFetchTileTask: No data.
10-02 00:11:42.536: DEBUG/hellomap(404): DbMapLayer task: Start loading zoom=10 x=278 y=444
10-02 00:11:42.636: DEBUG/TileDatabaseHelper(404): not found z=10 x=278 y=579
10-02 00:11:42.636: ERROR/hellomap(404): com.nutiteq.layers.raster.MBTilesMapLayer$DbFetchTileTask: No data.
10-02 00:11:42.746: DEBUG/hellomap(404): DbMapLayer task: Start loading zoom=10 x=277 y=443
10-02 00:11:42.746: DEBUG/TileDatabaseHelper(404): not found z=10 x=277 y=580
10-02 00:11:42.746: ERROR/hellomap(404): com.nutiteq.layers.raster.MBTilesMapLayer$DbFetchTileTask: No data.
10-02 00:11:42.947: DEBUG/hellomap(404): DbMapLayer task: Start loading zoom=10 x=278 y=443
10-02 00:11:43.186: DEBUG/hellomap(404): onDrawFrame: Last frame time 325ms
10-02 00:11:43.346: DEBUG/TileDatabaseHelper(404): not found z=10 x=278 y=580
10-02 00:11:43.360: ERROR/hellomap(404): com.nutiteq.layers.raster.MBTilesMapLayer$DbFetchTileTask: No data.
10-02 00:11:43.360: DEBUG/hellomap(404): DbMapLayer task: Start loading zoom=10 x=277 y=445
10-02 00:11:43.596: DEBUG/hellomap(404): onDrawFrame: Last frame time 230ms
10-02 00:11:43.706: DEBUG/TileDatabaseHelper(404): not found z=10 x=277 y=578
10-02 00:11:43.706: ERROR/hellomap(404): com.nutiteq.layers.raster.MBTilesMapLayer$DbFetchTileTask: No data.
10-02 00:11:43.706: DEBUG/hellomap(404): DbMapLayer task: Start loading zoom=10 x=278 y=445
10-02 00:11:43.706: DEBUG/TileDatabaseHelper(404): not found z=10 x=278 y=578
10-02 00:11:43.706: ERROR/hellomap(404): com.nutiteq.layers.raster.MBTilesMapLayer$DbFetchTileTask: No data.
10-02 00:11:43.966: DEBUG/hellomap(404): onDrawFrame: Last frame time 249ms
我猜这个脚本有问题,但事实是他正在使用与MapBox iOS SDK相同的.mbtiles文件而没有问题。
我希望有人使用地图,最好是使用MBTiles和/或Nutiteq可以提供一些见解。
感谢。
答案 0 :(得分:3)
从日志中可以看出,数据库中缺少所请求的地图图块。您可以使用
进行检查sqlite3 <file>.mbtiles
sqlite> select * from tiles where zoom_level=10 and tile_column=277 and tile_row=579;
如果返回空数据,则数据不存在。如果它返回一行,则检查文件是否正确打开。
还有可能会翻转y,因为TMS的起源不同于常见的Web地图图块(如OSM)。你可以在应用程序中更改它,MBTilesLayer有setTmsY(),尝试将其设置为true。