I am new to android.I have converted map to mbtiles format.Now I need to create a sample application using nutiteq to display mbtiles on mobile.Please explain me step by step by writing code for displaying map. Dont give me links of some existing projects because I don't understand them,and there must be many people who must be expecting a sample android app explained step by step, which displays mbtiles using nutiteq.
Asked
Active
Viewed 1,045 times
1 Answers
2
I assume you know Android general app development. If not, there are many books and instructions available. Regarding Nutiteq and MBTiles:
- Nutiteq wiki has instructions how to get started
- To get Nutiteq SDK as minimum you need nutiteq-sdk.jar, and javaproj-1.0.6-noawt.jar in your project libs folder
- Copy MBTiles file to your device /sdcard folder (or elsewhere)
- To replace online map with MBTiles you need to change map layer definition, replace
TMSMapLayer mapLayer = new TMSMapLayer(new EPSG3857(), 0, 18, 0, "http://otile1.mqcdn.com/tiles/1.0.0/osm/", "/", ".png");
with:
try { MBTilesMapLayer dbLayer = new MBTilesMapLayer(proj, 0, 19, 2, "/sdcard/mymaps.mbtiles", this); mapView.getLayers().addLayer(dbLayer); } catch (IOException e) { // means usually that given .mbtiles file is not found or cannot be opened as sqlite database Log.error(e.getLocalizedMessage()); e.printStackTrace(); }

JaakL
- 4,107
- 5
- 24
- 37
-
I used the code you provided and the jar files mentioned but its not recoginzing "MBTilesMapLayer". Its showing that "MBTilesMapLayer is not a resolved type." What may be the problem? – himanshu Oct 11 '13 at 05:14
-
1Right click your project Properties->JavaBuildPath->Libraries....add the jar files from the lib folder->Order and Export....check the jars and click OK – WISHY Oct 11 '13 at 09:41