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

05-28-2018 09:51 PM
Occasional Contributor

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("");


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);
for(int j=0;j<mMap.getOperationalLayers().size(); j++)
  Layer o = mMap.getOperationalLayers().remove(0);

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.

2 Replies
Regular Contributor II

This doesn't sound right. You should be able just to modify the basemaps/operational layers like you do with any other map. You could try to replace the Basemap with a new instance instead of changing the layers inside of the existing basemap. 

Remember to check that the basemap is in the same Spatial Reference with the map, if it isn't then you won't be able to see it. I tried to use the code from the 1st option in .NET and it seems to work (when the map is in the same SR). What I did before that was clearing the current baselayers and then adding the new layer as well. Could you verify that the Map, Basemap Service and Operational Layers are in the correct SR?

0 Kudos
Occasional Contributor

In ArcGIS PRO, the Map that I created the Mobile Map package from lists its reference as WGS 1984 Web Mercator Auxiliary Sphere. I believe that is the same for your World Topo Map and just about everything.

In the debugger, I can log the spatial reference for the Mobile Map.

The getSpatialreference returns null for all the layers, including the World Topo Layer.

Log.i(TAG,"Mobile Map SR: "  + mMap.getSpatialReference().getWKText());

Mobile Map SR:

ArcGISTiledLayer tiledLayerBaseMap = new ArcGISTiledLayer("");

If I add the World Topo Map to the basemap after adding the map to the MapView, it definitely does not show.
The layers from the Mobile Map do show on a grid.

If I add the World Topo Map to the basemap before adding the map to the MapView, NOTHING shows.
Mapview is all gray with out even a grid or a notice about "Developer Use Only.
0 Kudos