AnsweredAssumed Answered

How to use other layers with Mobile Map Package (mmpk)?

Question asked by Crittermap on May 28, 2018
Latest reply on May 29, 2018 by Crittermap

How would I go about using other layers with those in a Mobile Map package?

 

The examples assume i want the

// Create a MobileMapPackage from the offline map directory pathfinal MobileMapPackage offlineMapPackage = new MobileMapPackage(mMobileMapPackage); offlineMapPackage.loadAsync(); offlineMapPackage.addDoneLoadingListener(new Runnable() {   @Override  public void run() {     // Get the title from the package metadata    System.out.println("Title: " + offlineMapPackage.getItem().getTitle());      // Get the map from the package and set it to the MapView    mMapView.setMap(offlineMapPackage.getMaps().get(0));   } });

But suppose the MobileMap lacks a basemap or some other layer that is packaged separately.

The following things DON'T work.
1. Load map from package, then add layers to it.
  ArcGISTiledLayer tiledLayerBaseMap = new ArcGISTiledLayer("http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer");

mMap.getBasemap().getBaseLayers().add(tiledLayerBaseMap);

No errors. The basemap seems to be added. I just never see it.

2. Try to detach the layers from the mobile map packagemap and place it in an already created map.
mMap = mapPackage.getMaps().get(0);


ArcGISMap defaultMap = new ArcGISMap(Basemap.Type.TOPOGRAPHIC_VECTOR,44.417,-112.08,11);
for(int i=0;i<mMap.getBasemap().getBaseLayers().size(); i++)
{
  Layer l = mMap.getBasemap().getBaseLayers().remove(0);
  defaultMap.getBasemap().getBaseLayers().add(l);
}
for(int j=0;j<mMap.getOperationalLayers().size(); j++)
{
  Layer o = mMap.getOperationalLayers().remove(0);
  defaultMap.getOperationalLayers().add(o);
}

This works even less. The map is completely invalid and only shows gray. Not even a grid.

What might still work:

3. Unpack the mobile map package and load the .geodatabase(s) individually from file. Look for them in the p14 folder.
4. Distribute .geodatabase files and other files separately.
Since .geodatabase is not one of the file types allowed as a portal item in ArcGIS Online, I don't think that is intended.


Outcomes