escapist_wt

how to add two map to a view controller

Discussion created by escapist_wt on Mar 14, 2011
Latest reply on Mar 15, 2011 by njarecha-esristaff
I want to add two AGSMapview to  MainViewController. I archieve adding mapviews to controller and adding AGSGraphicsLayers to this maps. But the problem is that my graphics on the graphics layers are not drawn correctly. My code :

-(void)viewDidLoad{
AGSMapview mapView1 =[[AGSMapView alloc]initWithFrame:.......];

AGSMapview mapView2 =[[AGSMapView alloc]initWithFrame:.......];
// add tiled map service layers to maps

AGSTiledMapServiceLayer *tiledLayer1 = [AGSTiledMapServiceLayer  ....];
AGSTiledMapServiceLayer *tiledLayer2 = [AGSTiledMapServiceLayer  ......];

AGSGraphicsLayer *graphicsLayer1 = ......
AGSGraphicsLayer *graphicsLayer2 = ......

  [self.mapView1 addMapLayer:tiledLayer1 withName:@"Tiled Layer 1"];
[self.mapView2 addMapLayer:tiledLayer2 withName:@"Tiled Layer 2"];

[self.mapView1 addMapLayer:graphicsLayer1 withName:@"Graphics Layer 1"];
[self.mapView1 addMapLayer:graphicsLayer2 withName:@"Graphics Layer 2"];
}

-(void)mapViewDidLoad:(AGSMapView*)mapView{
AGSMutablePolyLine poly1 , poly2;
AGSSimpleLineSymbol *line1 = ......;
AGSSimpleLineSymbol *line2 = ......
AGSGraphic* myGraphic1 = ......;

AGSGraphic* myGraphic2 = ....... ;


[graphicsLayer1 addGraphic:myGraphic1 ];
[graphicsLayer1 dataChanged];

[graphicsLayer2 addGraphic:myGraphic2];
[graphicsLayer2 dataChanged];
}


if i add only one map to controller , graphics are correct. But if i add two map to controller graphics are drawn wrong.

Briefly , How to I add two mapview to UIViewController with graphics layer ?

Outcomes