Add Point Feature - Not adding Geometry

846
7
09-19-2011 01:29 PM
DarrenMackiewicz
Occasional Contributor
Hi
I'm attempting to use the FeatureEditingSample codebase to add a point feature to my map.
(I changed the code to not use a WebMap, but rather a Feature Service).
The code is executing, and a new record with an ObjectID all of the attributes are being posted to ArcSDE, but there is no geometry associated with it, so the point won't display on the map, of course.

Is there something special I have to do when working with a Point Feature Class when using the FeatureEditing Code Sample?
0 Kudos
7 Replies
DarrenMackiewicz
Occasional Contributor
Update on what's happening.
After I click 'Sketch Done', the sketch disappears, but the Feature Symbology (From the template) does not show up.
I'm getting no errors, and stepping through the code, it seems that everything is happening as it should.

😞
0 Kudos
hermancheah
New Contributor
hi i am not sure if we are on the same issue
inside featuretemplatepickerviewcontroller there is - addtemplatesfromlayer

- (void) addTemplatesFromLayer:(AGSFeatureLayer*)layer {
   
    NSLog(@"addTemplatesFromLayer at : %@",layer);
  
i load a layer inside from FeatureLayerEditingSampleViewController.m

    [self.featureTemplatePickerViewController addTemplatesFromLayer:self.OnOffLineLayer];
   
and wala.. i got the feature type.
0 Kudos
hermancheah
New Contributor
hi i am not sure if we are on the same issue
inside featuretemplatepickerviewcontroller there is - addtemplatesfromlayer

- (void) addTemplatesFromLayer:(AGSFeatureLayer*)layer {
   
    NSLog(@"addTemplatesFromLayer at : %@",layer);
  
i load a layer inside from FeatureLayerEditingSampleViewController.m

    [self.featureTemplatePickerViewController addTemplatesFromLayer:self.OnOffLineLayer];
   
and wala.. i got the feature type.
0 Kudos
NimeshJarecha
Esri Regular Contributor
Darren,

What is the spatial reference of your feature layer?
What is the spatial reference of your map (mapView)?
In which spatial reference you are creating new geometries?

You should create new geometries in the map's spatial reference so it can be displayed at correct location. When you post your edits to server, server will take care of converting it to feature layer's spatial reference.

Hope this helps!

Regards,
Nimesh
0 Kudos
DarrenMackiewicz
Occasional Contributor
Hi Nimesh

Spatial Feature of the FService is : 2249

The spatial ref of my mapview is the same (2249).

The process runs, no errors are thrown.  However, the feature with its symbology don't show in my map as it does in the example and when I open the Feature Class in SDE and I see the attributes, but there is no geometry.

I've attached the editresults during debug.

Also, I'm using my own map service not webmap.

    AGSMapServiceInfo *bms = [[[AGSMapServiceInfo alloc] initWithURL:[NSURL URLWithString:baseLayerURL] error:&error] autorelease];
        AGSDynamicMapServiceLayer *baseLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:bms];



also at didSelectFeatureTemplate


//set the active feature layer to the one we are going to edit
    self.activeFeatureLayer = featureLayer;
   
    //create a new feature based on the template
    _newFeature = [self.activeFeatureLayer createFeatureWithTemplate:template];
   

    [self.activeFeatureLayer addGraphic:_newFeature];
   
    AGSGraphic *gr = _newFeature;

    self.popupInfo = [AGSPopupInfo popupInfoForGraphic: gr];
   
    self.popupInfo.allowEditGeometry = YES;
    self.popupInfo.showAttachments = YES;
   
    //Filter the fields we want to display to the user
   
    NSMutableArray* fieldInfos = [self.popupInfo.fieldInfos mutableCopy];
   
    NSMutableArray* displayFields = [[[NSMutableArray alloc] init] autorelease];
    NSArray* inspectiondisplayeditfields = [[[NSArray alloc] init] autorelease];
   
   
    inspectiondisplayeditfields = self.fieldsForEditing;
   
   
    for (AGSPopupFieldInfo* fieldInfo in fieldInfos) {
       
        for (int i = 0 ; i < [inspectiondisplayeditfields count] ; i++) {
           
            if ([fieldInfo.fieldName isEqualToString:[inspectiondisplayeditfields objectAtIndex:i]])
            {
                [displayFields addObject:fieldInfo];
               
            }
           
           
        }
       
       
    }
   
   
    self.popupInfo.fieldInfos = displayFields;
   
   
    //Show popup for the graphic because the user tapped on the callout accessory button
    self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:_popupInfo graphic:gr usingNavigationControllerStack:NO] autorelease];
    self.popupVC.delegate = self;
    self.popupVC.modalTransitionStyle =  UIModalTransitionStyleFlipHorizontal;
    //If iPad, use a modal presentation style
    if([[UIDevice currentDevice] isIPad])
        self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;
   
    //    //First, dismiss the Feature Template Picker
        [self dismissModalViewControllerAnimated:NO];
   
    [self presentModalViewController:self.popupVC animated:YES];
    [self.popupVC startEditingCurrentPopup];
   
   
    [fieldInfos release];
0 Kudos
NimeshJarecha
Esri Regular Contributor
Is graphic/feature has valid geometry before sending it to server?

If you're geometry is not in either WGS 1984 or Web Mercator spatial references then you must comment out following code line from sample.
popup.graphic.geometry = [[AGSGeometryEngine defaultGeometryEngine]normalizeCentralMeridianOfGeometry:popup.graphic.geometry];

Regards,
Nimesh
0 Kudos
DarrenMackiewicz
Occasional Contributor
Thanks Nimesh - That was the issue!!!
0 Kudos