Select to view content in your preferred language

Changing BaseMap using Gallery

2703
2
Jump to solution
11-08-2012 04:13 PM
JeffGiesler
Deactivated User

Hello Everyone,
I am having trouble changing my base map from and to one of the ESRI basemaps in my app.  I can get the portal group and items fine but when I try to get a AGSWebMap from the PortalItem and then try to create a base map from there I get a null basemap value.  I have been trying to follow this thread

http://forums.arcgis.com/threads/57085-basemap-gallery?highlight=base and the portal sample but i seem to be failing somewhere.  Below is my current code for trying get the AGSWebMapBaseMap so I can use the openIntoMapView withAlternateBaseMap method. 
Any help would be great.
Cheers,
Jeff
(void) didSelectNewBaseMap:(AGSPortalItem *)BaseMapPortalItem {     AGSWebMap *NewBaseWebMap = [[AGSWebMap alloc] initWithPortalItem:BaseMapPortalItem];     AGSWebMapBaseMap *NewWebmapBaseMap = [[AGSWebMapBaseMap alloc]init];     NewWebmapBaseMap = [NewBaseWebMap baseMap];     [self.webmap openIntoMapView:self.mapView withAlternateBaseMap:NewWebmapBaseMap resetMapView:NO]; }  
0 Kudos
1 Solution

Accepted Solutions
NimeshJarecha
Esri Regular Contributor
Hi Jeff,

Your code should look like this...

-(void) didSelectNewBaseMap:(AGSPortalItem *)BaseMapPortalItem {     AGSWebMap *NewBaseWebMap = [AGSWebMap webMapWithPortalItem:BaseMapPortalItem];     NewBaseWebMap.delegate = self; }  //webmap delegate - (void)webMapDidLoad:(AGSWebMap *)webMap {     [self.webmap openIntoMapView:self.mapView withAlternateBaseMap:webMap.baseMap]; }


Regards,
Nimesh

View solution in original post

0 Kudos
2 Replies
NimeshJarecha
Esri Regular Contributor
Hi Jeff,

Your code should look like this...

-(void) didSelectNewBaseMap:(AGSPortalItem *)BaseMapPortalItem {     AGSWebMap *NewBaseWebMap = [AGSWebMap webMapWithPortalItem:BaseMapPortalItem];     NewBaseWebMap.delegate = self; }  //webmap delegate - (void)webMapDidLoad:(AGSWebMap *)webMap {     [self.webmap openIntoMapView:self.mapView withAlternateBaseMap:webMap.baseMap]; }


Regards,
Nimesh
0 Kudos
JeffGiesler
Deactivated User
Nimesh,
That worked thanks a lot.
Cheers,
Jeff
If anyone is interested below is the exact code I used.
-(void) didSelectNewBaseMap:(AGSPortalItem *)BaseMapPortalItem
{
    AGSWebMap *BaseWebMap = [[AGSWebMap alloc] initWithPortalItem:BaseMapPortalItem];
    BaseWebMap.delegate = self;
    [self.sslchangeBaseMapdismissViewControllerAnimated:YEScompletion:nil];
}
- (void) webMapDidLoad:(AGSWebMap *)webMap 
{
    [self.webmapopenIntoMapView:self.mapViewwithAlternateBaseMap:webMap.baseMap];
}



0 Kudos