1

我正在使用 Nutiteq SDK 开发一个 Android 地图应用程序,该应用程序需要离线工作并显示一个小城市的地图,所以我使用 .mbtiles 文件。到目前为止,使用 TileMill 下载的 .mbtile 文件效果很好,或者更确切地说是他们的演示项目之一,因为 Internet 访问有时对我来说是个大问题,出于同样的原因,当我的一个朋友告诉我他写了一个Python 脚本,用于从tiles .png 文件夹创建一个.mbtiles 文件,具有精确的.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 的人可以提供一些见解。

谢谢。

4

1 回答 1

1

From the log it seems that the requested map tiles are just missing from the database. You can check it with

sqlite3 <file>.mbtiles
sqlite> select * from tiles where zoom_level=10 and tile_column=277 and tile_row=579;

If this returns empty data, then the data is not there. If it returns a line, then check that the file was opened properly.

There is also possibility that y is flipped, as TMS has different origin than common web map tiles (like OSM). You can change this in application, MBTilesLayer has setTmsY(), try to set it true.

于 2013-10-02T07:58:25.390 回答