AnsweredAssumed Answered

AGSGraphicsLayer not showing

Question asked by ahmed.elashker-esrinea-esridist on Mar 19, 2014
Latest reply on Mar 20, 2014 by ahmed.elashker-esrinea-esridist
1- After creating the basemap layer
self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"];


2- I'm using GeoTrigger service and I call the "trigger/list" instruction. I use the code in the "Turn a trigger region into an AGSGeometry object" from this link https://developers.arcgis.com/geotrigger-service/guide/using-geotrigger-sdk-with-arcgis-runtime-sdk/#ios

CLLocation *location = self.locations[0];      NSDictionary *params = @{@"geoFormat": @"esrijson", @"geo":                                  @{@"latitude": @(location.coordinate.latitude), @"longitude": @(location.coordinate.longitude), @"distance": @100}};      [[AGSGTApiClient sharedClient] postPath:@"trigger/list"                                  parameters:params                                     success:^(id responseObject) {                                         if (responseObject != nil) {                                                                                          NSArray *triggers = responseObject[@"triggers"];                                             for (NSDictionary *trigger in triggers) {                                                 NSDictionary *condition = trigger[@"condition"];                                                 NSDictionary *geo = condition[@"geo"];                                                 NSDictionary *esriJson = geo[@"esrijson"];                                                                                                  AGSGeometry *geometry = AGSGeometryWithJSONAndSR(esriJson, [self.mapView spatialReference]);                                                                                                  // Do stuff with geometry!                                                                                                  AGSFillSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol];                                                 symbol.color = [UIColor redColor];                                                                                                  //Create the AGSSimpleLineSymbol used for the outline                                                 AGSSimpleLineSymbol* myOutlineSymbol = [AGSSimpleLineSymbol simpleLineSymbol];                                                 myOutlineSymbol.color = [UIColor redColor];                                                 myOutlineSymbol.width = 2;                                                                                                  //set the outline property to myOutlineSymbol                                                 symbol.outline = myOutlineSymbol;                                                                                                  AGSGraphic *LocationDisplay = [[AGSGraphic alloc] initWithGeometry:geometry symbol:symbol attributes:nil];                                                                                                  [self.graphicsLayer addGraphic:LocationDisplay];                                                                                                  [self.graphicsLayer refresh];                                                                                                  [self.mapView zoomToGeometry:[LocationDisplay geometry] withPadding:0 animated:YES];                                             }                                         }                                     }                                     failure:^(NSError *error) {                                         NSLog(@"Error listing triggers: %@", error);                                     }];


The codes zooms me to desired trigger area successfully, but it never shows the symbol for the graphic.

I refer to the following link regarding graphics layers https://developers.arcgis.com/ios/guide/creating-a-graphics-layer.htm#ESRI_SECTION1_782802E7EF1E479C8FD6C29E5690ADA2

I've tried with a simpleFillSymbol, then with this outlineSymbol. I then tried using a TextSymbol instead, I even swiped away the whole basemap layer after zooming and still nothing shows from the graphicsLayer.

What am I not doing right here?

Outcomes