Manually set initial extent on basemaps with offline map files (.tpk)

748
2
11-14-2017 04:59 AM
JasonChristian
New Contributor II

Hi,

As the title suggests, I would like to know how to manually set the extent of the map which is using a basemap consisting of loaded tpk files. By default, it will only set the extent as far as the region the tpk files give, but I would like to manually set it up to cover wider area (Possibly, the maximum extent, e.g (-180, -90, 90, 180))


EDIT: I'm using Android's runtime SDK of the latest version (100.1.0)

0 Kudos
2 Replies
ShellyGill1
Esri Contributor

Hi Jason,

There's no explicit way to set the maximum visible extent of a Map - that is taken automatically from the Basemap when it loads, as you state above. You're talking about having the maximum extent as -180-180, -90-90, so I'm assuming that your TPK might be in WGS84, or some other similar global spatial reference? You could create the Map from the same SpatialReference as your TPK (as tiles are not reprojected, then you'd need to do this so the layer displays). At that point the map has the full extent you wanted. Then set your Basemap after that. (Bear in mind that TPKs might have min/max scales and extents that mean the layer is not visible by default, so you might want to consider the map tools you provide to bring the layers back into view for your users.)

Hope this helps,

Shelly

0 Kudos
JasonChristian
New Contributor II

Shelly Gill wrote:

You could create the Map from the same SpatialReference as your TPK (as tiles are not reprojected, then you'd need to do this so the layer displays). At that point the map has the full extent you wanted.

Can you show me some sample code on how to do this? I cannot find any references on this in the docs or guides

Let me explain the problem more clearly:

So I have 2 TPK files. Let's say 1 of them covers a small portion of the city of Eugene, Oregon, USA and another one covers a small portion of Portland. That means, the 1st TPK file's region is below the 2nd TPK file's region. The problem is, when I load both of them in a basemap, I am not able to pan the map from Oregon to Portland. The panning's stuck on the region of Oregon only.

Different case happens if the 2 TPKs are on the left or right of each other (Example: 1st TPK file is of Eugene, Oregon, USA and the 2nd one is of the city of Bend, Oregon, USA). In this case, I am able to pan the map to view both maps.

That is why I asked whether there's a way to set the map's extent to its fullest.

Thank you,

Jason

0 Kudos