问题描述
我试图加载瓷砖源,但由于某些原因,它doenst工作。
这里是我的code:
I'm trying to load a tile source, but for some reason it doenst work.Here's my code:
final IRegisterReceiver registerReceiver = new SimpleRegisterReceiver(this);
// Create a custom tile source
final ITileSource tileSource = TileSourceFactory.MAPNIK;
// Create a file cache modular provider
final TileWriter tileWriter = new TileWriter();
final MapTileFilesystemProvider fileSystemProvider = new MapTileFilesystemProvider(registerReceiver, tileSource);
File myMapTileSource = new File(mapsDirectory.getPath()+File.separator+"Lisboa.gemf");
// Create an archive file modular tile provider
IArchiveFile[] archives = { ArchiveFileFactory.getArchiveFile(myMapTileSource) };
MapTileFileArchiveProvider fileArchiveProvider = new MapTileFileArchiveProvider(registerReceiver, tileSource, archives);
// Create a download modular tile provider
final NetworkAvailabliltyCheck networkAvailablilityCheck = new NetworkAvailabliltyCheck(this);
final MapTileDownloader downloaderProvider = new MapTileDownloader(tileSource, tileWriter, networkAvailablilityCheck);
// Create a custom tile provider array with the custom tile source and the custom tile providers
final MapTileProviderArray tileProviderArray = new MapTileProviderArray(tileSource, registerReceiver, new MapTileModuleProviderBase[] { fileSystemProvider, fileArchiveProvider, downloaderProvider });
// Create the mapview with the custom tile provider array
mMapView = new MapView(this, 256, new DefaultResourceProxyImpl(this), tileProviderArray);
mMapView.setUseDataConnection(false);
出于某种原因,这工作,我可以看到里斯本离线地图。
For some reason this works and i can see the map of lisbon offline.
如果我切换行
File myMapTileSource = new File(mapsDirectory.getPath()+File.separator+"Lisboa.gemf");
为
File myMapTileSource = new File(mapsDirectory.getPath()+File.separator+"Lissabon.osm");
它doenst工作。它返回一个错误错误加载砖,从MapTileFileArchiveProvider。
it doenst work. It returns an error "Error loading tile" from MapTileFileArchiveProvider.
该gemf文件是在创建MOBAC。 OSM的文件是从下载。
The gemf file was created in MOBAC. The osm file was downloaded from here.
任何人都可以解释我为什么它doenst工作的?
Could anyone explain me why it doenst work?
推荐答案
如果您看一看<一个href=\"https://$c$c.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/ArchiveFileFactory.java\"相对=nofollow> ArchiveFileFactory ,你会看到GEMF文件都支持,但.osm文件都没有。我不知道是什么格式.osm文件(也许它是一种支持的格式,只是需要被重新命名?)
If you take a look at ArchiveFileFactory, you'll see that GEMF files are supported, but .osm files are not. I'm not sure what format .osm files are (maybe it's one of the supported formats and just needs to be renamed?)
这篇关于装载瓷砖源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!