1

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.

himanshu
  • 41
  • 1
  • 2
  • 11

1 Answers1

2

I assume you know Android general app development. If not, there are many books and instructions available. Regarding Nutiteq and MBTiles:

  1. Nutiteq wiki has instructions how to get started
  2. To get Nutiteq SDK as minimum you need nutiteq-sdk.jar, and javaproj-1.0.6-noawt.jar in your project libs folder
  3. Copy MBTiles file to your device /sdcard folder (or elsewhere)
  4. 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
  • 1
    Right 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