-
Notifications
You must be signed in to change notification settings - Fork 21
Navigation
nixta edited this page Jan 18, 2013
·
2 revisions
##Overview Methods are available on AGSMapView to center the map at a given lat/lon, or to zoom to a predefined zoom level (1-20), optionally centering on a location (see AGSMapView+EQSNavigation.h):
// Add a method to go with centerAtPoint:animated: that allows lat/lon as input.
- (void) centerAtLat:(double)latitude lon:(double)longitude animated:(BOOL)animated;
// Add to the existing zoomTo... methods with a set of zoomToLevel methods.
- (void) zoomToLevel:(NSUInteger)level animated:(BOOL)animated;
- (void) zoomToLevel:(NSUInteger)level withCenterPoint:(AGSPoint *)centerPoint animated:(BOOL)animated;
- (void) zoomToLevel:(NSUInteger)level withLat:(double)latitude lon:(double)longitude animated:(BOOL)animated;In addition, methods are added to pan or zoom to the device's current location:
// Add some methods to center and zoom to a device's geolocation. See also the EQSGeoServices class.
- (void) centerAtMyLocation;
- (void) centerAtMyLocationWithZoomLevel:(NSUInteger)level;Lastly, property wrappers are added to get or set the map's current centerpoint or zoom level.
// Set or get the centerpoint of the map's current visible extent. Setting is animated.
@property (nonatomic, assign) AGSPoint *centerPoint;
// Set or get the map's nearest zoom level (an integer in the range 1-20). Setting is animated.
@property (nonatomic, assign) NSUInteger zoomLevel;Note: Zoom Levels match standard web-tiling schemes, including ArcGIS Online. ArcGIS in general uses more flexible map scales (ratios). The mapping between Zoom Levels and Map Scales is defined in the EQSConfig.plist file.
Set the AGSMapView to center in New York at zoom level 13:
[self.mapView zoomToLevel:13 withLat:40.7302 lon:-73.9958 animated:YES];For example (see also Basemaps):
- (void)viewDidLoad
{
[super viewDidLoad];
// Set up our map with a basemap, and jump to a location and scale level.
self.mapView.basemap = EQSBasemapTypeStreet;
[self.mapView zoomToLevel:13 withLat:40.7302 lon:-73.9958 animated:YES];
}