Question

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.

Was it helpful?

Solution

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();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top