AnsweredAssumed Answered

How to support custom tiled map format in Runtime v100 ?

Question asked by pbolduc on Oct 16, 2017
Latest reply on Oct 16, 2017 by ANohe-esristaff



We are trying to migrate one of our applicatoin from v10.2.9 to v100.1. We need to support map formats that are currently unsupported in the new runtime (i.e. : MBTiles). In our case, the system is always offline and the map are stored locally on the Android device.


It was easy to do that in the previous version (Creating a custom TileServiceLayer in ArcGIS Android | ArcGIS Blog ), but I had no success so for on the new v100.1.


I tried to extend the ImageTiledLayer, but I get an exception when I try to create a TileInfo using the following code :


public static ImageTiledLayer createMBTilesLayer(final Uri databaseUri)
    final SQLiteDatabase database = SQLiteDatabase.openDatabase(databaseUri.getPath(), null, SQLiteDatabase.OPEN_READONLY, new ErrorHandler());
    final int maxLevel = retrieveMaxLevel(database);

    final List<LevelOfDetail> levelOfDetails = new ArrayList<>();
    for(int i = 0; i < maxLevel; i++)
        levelOfDetails.add(new LevelOfDetail(i, 156543.032 / Math.pow(2, i), 554678932 / Math.pow(2, i)));

    final TileInfo tileInfo = new TileInfo(96, TileInfo.ImageFormat.JPG, levelOfDetails, new Point(0, 0), SpatialReferences.getWebMercator(), 256, 256);

    return new MBTilesLayer(tileInfo, new Envelope(-180.0, -85.0, 180, 85, SpatialReferences.getWebMercator()), database);


java.lang.RuntimeException: Unable to start activity ComponentInfo{}: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)

Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Invalid argument
at com.esri.arcgisruntime.internal.jni.CoreTileInfo.nativeCreateWith(Native Method)
at com.esri.arcgisruntime.internal.jni.CoreTileInfo.<init>(SourceFile:72)
at com.esri.arcgisruntime.arcgisservices.TileInfo.<init>(SourceFile:121)



Is it the right approach to support other tiled format ? Is it some obvious error in the code snippet above that I do not see ?