Select to view content in your preferred language

Problem in showing maps with different Geographic boundaries

281
1
06-08-2023 01:27 AM
YanRusanovsky
New Contributor

Hello,

I'm using ArcGIS Runtime SDK  in my Android application.

I need to show two maps with differnt geographical boundaries, the maps are in tpk format.

When the application starts, I'm loadind the maps via getBasemap.getBaseLayers().add.. and set them invisible. 

When the user wants to see the map, I set the layer visible.

The problem is that the application shows only one map, the first tpk that was loaded.

I've tried to remove the layer and add another, tried to call Map.SetInitialViewPoint from the Envelope of the second layer. Nothing helps.

I would appriciate any help 

Yan

0 Kudos
1 Reply
Nicholas-Furness
Esri Regular Contributor

Hi,

There are a few things that could be going on:

Are the spatial references of the TPKs the same? The Runtime SDKs do not reproject tiled layers, so they need to match the spatial reference of the map (which is derived from the spatial reference of the Basemap if there is one), otherwise they will not display.

One other thing to look at: the initialViewpoint is a state property on the Map. It's used by the MapView to know how to initially display the map. After that, as you display the map and use it, you set the viewpoint by calling one of the setViewpoint methods on MapView.

So, if TPK 2 has the same spatial reference as TPK 1, and you use the MapView.setViewpointGeometryAsync() method to the envelope of the second layer, the Map View should zoom to the 2nd TPK. You will of course need to set the layer for TPK 2 to visible.

0 Kudos