AnsweredAssumed Answered

programmatically added graphics always display at 0,0

Question asked by spencerkohan on Jul 17, 2012
Latest reply on Jul 18, 2012 by spencerkohan
I'm new to ArcGIS, and I'm having trouble getting graphics I've added to the map programmatically to show up at the desired lat/lng coordinates.  Instead they display at (0,0) off the coast of Africa no matter what coordinates are passed in.  Here's the code I'm using to create and place the symbols:

                 graphicsLayer = [[AGSGraphicsLayer alloc] init];         [mapView insertMapLayer:graphicsLayer withName:@"graphics layer" atIndex:1];   AGSGraphic* g;    //Create the AGSSimpleMarker Symbol and set some properties  AGSSimpleMarkerSymbol* myMarkerSymbol = [AGSSimpleMarkerSymbol simpleMarkerSymbol];  myMarkerSymbol.color = [UIColor blueColor];  myMarkerSymbol.style = AGSSimpleMarkerSymbolStyleDiamond;  myMarkerSymbol.outline.color = [UIColor whiteColor];  myMarkerSymbol.outline.width = 3;    //Create an AGSPoint (which inherits from AGSGeometry) that  //defines where the Graphic will be drawn    double lat = [[record objectForKey:@"lat"] doubleValue];  double lng = [[record objectForKey:@"lng"] doubleValue];    NSLog(@"Point: %f, %f", lat, lng);    AGSPoint* myMarkerPoint = [AGSPoint pointWithX:lat                  y:lng                                  spatialReference:mapView.spatialReference];    //Create the Graphic, using the symbol and  //geometry created earlier  g = [AGSGraphic graphicWithGeometry:myMarkerPoint           symbol:myMarkerSymbol              attributes:nil     infoTemplateDelegate:nil];          [graphicsLayer addGraphic:g];  


The map view is already loaded and displaying correctly when this code is executed.  If anyone can shed some light on what I might be missing it would be much appreciated.

Outcomes