rwmeier

Sketching Graphics - nothing showing up

Discussion created by rwmeier on Feb 15, 2012
Latest reply on Feb 15, 2012 by rwmeier
I am trying to sketch a graphic that i can then use to select some features. I have copied most of the code form the Sketch sample, but when I try and sketch I get nothing. What is the best way to diagnose this?

I can tell that the touchDelegate is no longer the map view, but how do I tell that it is set to the sketch layer? Also I can add a graphic to the graphic layer in code, but not to the sketch layer. here's the code for that.

    if ([self.selectedTool isEqualToString:@"Select"])
         {
             self.mapView.touchDelegate = self.sketchLayer;
            self.sketchLayer.geometry = [[[AGSMutablePolygon alloc] initWithSpatialReference: self.mapView.spatialReference] autorelease];
             //AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:4326];            
             AGSSimpleMarkerSymbol *sym = [AGSSimpleMarkerSymbol simpleMarkerSymbol];
             sym.color = [UIColor blueColor];
            
             AGSPoint* thPT = [AGSPoint pointWithX:1945905 y:266895 spatialReference:self.mapView.spatialReference];
             AGSGraphic* grf = [AGSGraphic graphicWithGeometry:thPT symbol:sym attributes:nil infoTemplateDelegate:nil];
             [self.sketchLayer addGraphic:grf];
             [self.sketchLayer dataChanged];
            
             //[self.graphicsLayer addGraphic:grf];
            
             //[self.graphicsLayer dataChanged];
                           
            
         }
    else
         {
             self.mapView.touchDelegate = self;
         }

I do have multiple map services that are in different spatial references, is that the issue?

any help is appreciated.

-bert

Outcomes