rg4133

AddFeature in AGSFeatureLayer

Discussion created by rg4133 on Dec 10, 2012
Latest reply on Dec 28, 2012 by njarecha-esristaff
I'm trying to add a new feature on the map
I have already build geometry and graphic, and i sure that graphic has got all the info
But i still can't get a new feature on the map

here is the cade , hope there has someone can help me fix the problem.

    
    AGSPictureMarkerSymbol *pt=[AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"ArcGIS.bundle/GpsDisplay.png"];    
    double lon = [[self.lonTextField text] doubleValue];
    double lat = [[self.latTextField text] doubleValue];
    
    AGSPoint * newpoint2 = [AGSPoint pointWithX:lon y:lat spatialReference:[AGSSpatialReference spatialReferenceWithWKID:4326 WKT:nil]];
    
    NSMutableDictionary *dic2 = [[NSMutableDictionary alloc] init];
    [dic2 setObject:self.typeTextField.text forKey:@"req_type"];
    [dic2 setObject:self.dateTextField.text forKey:@"req_date"];
    [dic2 setObject:self.timeTextField.text forKey:@"req_time"];
    [dic2 setObject:self.desTextView.text forKey:@"des"];
    [dic2 setObject:self.titleTextView.text forKey:@"title"];   
    [dic2 setObject:self.lonTextField.text forKey:@"x_coord"];
    [dic2 setObject:self.latTextField.text forKey:@"y_coord"];
    
    AGSGraphic * graphic=[[AGSGraphic alloc]initWithGeometry:newpoint2 symbol:pt attributes:dic2 infoTemplateDelegate:nil];
            
    graphic.attributes = dic2;
     
    //update the service 
    [ev.activeFeatureLayer addFeatures:[NSArray arrayWithObject:graphic]];

Outcomes