Select to view content in your preferred language

Zoom in When Map is Loaded

1551
4
Jump to solution
05-12-2014 12:31 PM
GSauers
Frequent Contributor
I just upgraded to ArcGIS 10.2.3 from 10.1.1 and most of my application works, but I am having trouble with zooming to a location.

Before in 10.1.1 I would use mMapView.zoomToResolution(point, resInt);

In 10.2.3, this same line of code causes the map to not display. I tried using the new map view options, but that does not seem to work either.

MapOptions mapO = new MapOptions(MapType.TOTO, lat, long, zoom level)

Does anyone know how to zoom to a specific level when entering or changing a map?

Thank you for the help.
0 Kudos
1 Solution

Accepted Solutions
GSauers
Frequent Contributor
I figured out how to get the map to zoom immediately. Instead of using zoomToResolution(), I used setScale(), which allowed me to deactivate animation. The map loads immediately with my desired zoom level.

Thanks again Joe for the help with this.


Here is more about setScale() and centerAt():
http://forums.arcgis.com/threads/58443-MapView-zoomToScale-and-zoomToResolution-not-working

View solution in original post

0 Kudos
4 Replies
JosephDwyer
Deactivated User
The zoom to resolution should work fine.  Th only thing I would say is check to make sure you are passing in a double and not an int for the resolution.
zoomToResolution (Point centerPt, double res)

if that doesn't work then you might be able to try the center and zoom.
centerAndZoom (double lat, double lon, float levelOrFactor)
0 Kudos
GSauers
Frequent Contributor
Thank you for the response Joe, I figured out that I needed to at the zoomToResolution() to the onChangedStatusListener. This works, but the map loads at a very zoomed out level and then it zooms in to the resolution I set. My application has multiple different screens so users are changing from a map view to other views and every time the user switches into map view, the map has to zoom in.

Before, in ArcGIS 10.1.1, the zoomToResolution() method was called outside of the change listener and it worked fine, where the map appeared at the desired zoom level immediately and did not have to take time to zoom in. I also tried adding the zoomToResolution within the listener and it works the way I want it to.

Any ideas/help are/is greatly appreciated. Thanks.
0 Kudos
JosephDwyer
Deactivated User
Thank you for the response Joe, I figured out that I needed to at the zoomToResolution() to the onChangedStatusListener. This works, but the map loads at a very zoomed out level and then it zooms in to the resolution I set. My application has multiple different screens so users are changing from a map view to other views and every time the user switches into map view, the map has to zoom in.

Before, in ArcGIS 10.1.1, the zoomToResolution() method was called outside of the change listener and it worked fine, where the map appeared at the desired zoom level immediately and did not have to take time to zoom in.

Any ideas/help are greatly appreciated. Thanks.


You can set the zoom level in the XML by using the following:

mapoptions.ZoomLevel = "5"


then you can kind of play with the starting number.  The bigger the number the farther out the starting zoom is.  Hope this helps.
0 Kudos
GSauers
Frequent Contributor
I figured out how to get the map to zoom immediately. Instead of using zoomToResolution(), I used setScale(), which allowed me to deactivate animation. The map loads immediately with my desired zoom level.

Thanks again Joe for the help with this.


Here is more about setScale() and centerAt():
http://forums.arcgis.com/threads/58443-MapView-zoomToScale-and-zoomToResolution-not-working
0 Kudos