In the "old" SDK for iOS and probably also for Android you're able to set a max envelop on the map view to define a panning area for the map.
How do I do that in the 100 SDK for Android? Can't find any method like that in the MapView class.
I could not find this either in the current SDK.
I would encourage you to log an enhancement request with your local esri distributor asking for the setMaxExtent() method to be brought back to the MapView class. This will give you a public tracking number which can then be used to check on the status of the enhancement.
The equivalent in the Android 10.x SDK seem to be setMaxExtent(), MapView | ArcGIS Android 10.2.9 API
Anyone have any suggestions how to implement such logic your self until this method is added to the 100 SDK?
Hi Emil Löfblom,
This is more of a hack until it is ready, but what you could do is implement a GeoView| arcgis-android addViewpointChangedListener(ViewpointChangedListener listener) and when the viewpoint changes, check the extent of the mapView. If the extent is outside what you want, then add setViewpointGeometryAsync(Geometry boundingGeometry) MapView| arcgis-android to zoom back to the extent you want. It won't stop people from panning outside the map extent, but when they do, they will automatically be panned back to the extent you wish to keep them in.
Thanks for the suggestion. That is actually what we have in place now, but it's not very pretty.
About logging an enhancement at my local ESRI distributor. Will it be sufficient to just create and idea in "ArcGIS Ideas"or is it better to contact the distributor, even though we don't have a support agreement in place?
Logging an enhancement on the ideas site should be fine.
Thanks for the workaround... being a newbie to arcgis's android API I'm struggling with getting this implemented.
I was able to add the viewpointChangedListener and get a reference to the geoView from via "viewpointChangedEvent.getSource()". I tried "(viewpointChangedEvent.getSource()).getTargetGeometry().getExtent()", but sometimes I get a null pointer exception on the target geometry object.
Further, I'm not really sure how to get my MapView and/or ArcGisMap's full envelope. What I'm looking for is the full extents of my map, which is a relatively small geographic area (think smaller than a zip code). Note: my maps are being loaded locally from mobile map (mmpk) and/or tile package (tpk) for strict offline usage. For now I know what max/min lat lons border my map are so I can hardcode those extents, but I'm not even sure how to create an envelope from lat lons vs x/y. So my other questions:
I am also wondering how you even get the full extent of a mapview? I do not want the currently visible extent, but the entire extent. This does not seem easily obtainable. Have been looking through the samples and don't see any evidence that there is a way to do it. In the old SDK there was a very easy method (MapView.getExtent()).
Great news Emil Löfblom! It looks as though there is an existing enhancement request logged with ESRI for this issue. The defect is: ENH-000104889 - Add a method to set the maximum extent of the map to Android Runtime 100.0.
I hope this helps!
I 100% agree that Max Extent is really important capability to have. I still do not see this in 100.2.1. Is there any possibility this will be in the upcoming 100.2.2??????
Retrieving data ...