Hi, I am trying to add a polyline to a graphics layer. But it is not getting displayed although it is not giving any error. Any help is highly appreciated!! Thanks Suman
The code is as below:
-(void)drawLine{ GisAppAppDelegate *mapDelegate =(GisAppAppDelegate *)[[UIApplication sharedApplication] delegate]; int i= [mapDelegate.geomObject count];// geomObject is a mutableArray in which I am storing the AGSPoint on map click if(i >= 2){ AGSMutablePolyline *polyline = [[AGSMutablePolyline alloc] initWithSpatialReference:self.mapView.spatialReference]; AGSSimpleLineSymbol *ln1=[AGSSimpleLineSymbol simpleLineSymbol]; ln1.color = [UIColor colorWithRed:9 green:0 blue: 0 alpha:0.5]; ln1.width = 5.0; ln1.style = AGSSimpleLineSymbolStyleSolid; [polyline addPathToPolyline]; for (int x1=0; x1< i; x1++) { AGSPoint *mappoint= [self.geomObject objectAtIndex:x1]; [polyline addPointToPath:[AGSPoint pointWithX:mappoint.x y:mappoint.y spatialReference:nil]]; } AGSGraphic *line=[[AGSGraphic alloc] initWithGeometry:polyline symbol:ln1 attributes:nil infoTemplateDelegate:nil]; [self.myGraphicsLayer removeAllGraphics]; [self.myGraphicsLayer addGraphic:line]; [self.myGraphicsLayer dataChanged]; } }
The spatial reference of the map as found in debugging is wkid :4326 wkt:nil
The spatial reference of the points stored in the NSMutableArray geomObject is : wkid:4326 wkt: out of scope.//although before getting added to the array the points have a wkt:nil
This is the code that is getting fired on clicking on the map and where the points are getting stored in the array.
Hi Nimesh, Thanks for taking so much pain. I am not able to attach the project here although the compressed project(.zip) is 1.2 MB. Can you send me an email address where I can send the zipped project. It will be really very helpful as I got stuck in it.