AnsweredAssumed Answered

Add webMap as layer to ArcGIS satellite mapView for iOS app project

Question asked by projitech on Nov 4, 2015
Latest reply on Nov 18, 2015 by Gagandeep_Singh-esristaff

I'm trying to code in a basic ArcGIS workflow into my iOS project. I am new to this platform and can use some pointers. My workflow is as follows.

 

 

1.) Create mapView displaying satellite (world style) map.

2.) Add a public webMap from my user account on ArcGIS Online as an overlay/layer on the satellite map.

 

 

What I've tried

   

    //.h

 

 

    #import <ArcGIS/ArcGIS.h>

 

 

    @interface ViewController : UIViewController <AGSWebMapDelegate>

 

 

    @property (strong, nonatomic) IBOutlet AGSMapView *mapView;

 

 

    //.m

 

 

    // Add basemap

   

    NSURL* url = [NSURL URLWithString:@"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"];

    AGSTiledMapServiceLayer *tiledLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:url];

    [self.mapView addMapLayer:tiledLayer withName:@"Basemap Tiled Layer"];

 

 

    //If I run this part alone, I'll get the satellite map.

 

 

 

 

    AGSWebMap* webmap = [[AGSWebMap alloc] initWithItemId:@"bb9b8c172e8142f995526bf658078f54" credential:nil];

    webmap.delegate = self;

    [webmap openIntoMapView:self.mapView];

 

 

    //When I add this webMap code and run the project, I get a blank white screen.

 

 

   

    //.m cont.

 

 

    - (void)mapViewDidLoad:(AGSMapView *) mapView {

    NSLog(@"mapView didLoad");   

    }

 

 

    - (void) webMapDidLoad:(AGSWebMap*) webMap {

    NSLog(@"webmap added successfully");

    }

 

 

    //Neither of these logs get called.

 

 

 

 

Questions.

 

 

1.) Is it right to use AGSTiledMapServiceLayer as my basemap? Also, is it right to use AGSWebMap for my ArcGIS Online map?

 

 

2.) My goal is to be able to add and remove multiple layers to and from a satellite basemap, one at a time. Am I on the right track?

 

 

I'm currently using MapBox to achieve this but I'm starting to experiment with ArcGIS SDK and it's features.

 

 

Thanks in advance.

Outcomes