Hello,
does anyone know to restrict map panning to an area?
Im trying to something similar to this:
https://www.mapbox.com/mapbox-gl-js/example/restrict-bounds/
But in my ArcGIS android application. I want to restrict my basemap, so that only my campus is displayed and not the whole world.
Thank you in advance!
Hi,
The following snippet of code can be used to apply a custom extent on one's basemap. In your case, it would be the extents of your campus.
Envelope myExtents = new Envelope(xmin,ymin,xmax,ymax);myExtents = (Envelope) GeometryEngine.project(myExtents, SpatialReference.create(102100), mMapView.getSpatialReference());mMapView.setMaxExtent(myExtents);mMapView.setExtent(myExtents);
Thanks.
The marked answer does not work with the ArcGIS Android 100.x API.
I want to implement same ..but in 100.3.0 its still saying "
setMaxExtent
method is not available..any other work around for same??
This is not yet implemented for runtime version 100.x
This enhancement request is currently open and our engineers are hard at work implementing it:
How can we achieve the camera bounds restriction on runtime sdk 100.1.0?
I have tried using similar method:
val bounds = Envelope(103.6, 1.161724, 104.09, 1.478184, SpatialReference.create(4326)) mViewMap.setViewPoint(ViewPoint(bounds))
*the above is in koltin
But it didn't have any effect on restricting the camera
I have loaded my map tiles using WmtsService
Thank you!
If you do not have an ArcMap license, you can use this tool called extent-helper:
JS Extent Helper
This should help you generate an extent in the web mercator projection.
Hope this helps!
Hi Thomas,
There are quite a few ways to get extents of a feature. One of them is as follows:
1. Select your campus feature and zoom to it.
2. From the top menu click on “View” and select “Data Frame Properties”.
3. Click on the Tab “Data Frame” and from the drop down under “Extents” select “Fixed Extent”.
4. This will show up the current extents of the current view with your selected feature.
Top = YMax, Bottom = YMin, Left = XMin, Right = XMax
Thanks
Thank you. And one final question. Do you know how i would be able to find the extents of my campus in ArcMap?
Which runtime are you trying to use?
In the latest runtime, this is yet to be exposed. There is an enhancement request placed for this to be added to the new runtime:
ENH-000104889 Add a method to set the maximum extent of the map to Android Runtime 100.0
Alternatively, if you are working with the 10.2.x version of the runtime, mirhashmi2014's answer would be correct.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.