Edit / Add Features with an offline Geodatabase doesn't work

4258
4
03-06-2014 11:59 PM
EikeLüders
New Contributor II
Hi,

I'm currently stuck with the implementation of an offline map.
My software uses an offline .geodatabase file to display features on the map.
To do so it reads the tables from the database and adds them to as a layer to the map:
[self.mapView addMapLayer:[[AGSFeatureTableLayer alloc] initWithFeatureTable:fTable]];


Now I had a look at the OfflineFeatureEditing sample code and added the source for adding new features in my application.
So far viewing the popups is fine but I am not able to edit the data. This is how I create the popup with the desired data from the featuretemplate:

AGSGDBFeatureTable* fTable = (AGSGDBFeatureTable*)layer;
AGSGDBFeature* feature = [fTable featureWithTemplate:featureTemplate];
AGSPopupInfo *pi = [AGSPopupInfo popupInfoForGDBFeatureTable:fTable];
AGSPopup *p = [[AGSPopup alloc] initWithGDBFeature:feature popupInfo:pi];
        
self.popupsVC = [[AGSPopupsContainerViewController alloc] initWithPopups:@

usingNavigationControllerStack:NO]; _popupsVC.delegate = self;         _popupsVC.modalPresentationStyle = UIModalPresentationFormSheet; [self presentViewController:_popupsVC animated:YES completion:nil]; [_popupsVC startEditingCurrentPopup];



No matter what I tried (startEditionCurrentPopup, setEditing:animated:, ...) the popup viewcontrollers property "inEditingMode" is always false.

Anyone has an idea please?
0 Kudos
4 Replies
DiveshGoyal
Esri Regular Contributor
Can you confirm that the service you generated this geodatabase from permits editing.

Also, there are methods on AGSGDBFeatureTable that the popup consults to decide whether or not to show the edit/delete options to the user. These methods are canUpdateFeature: & canDeletateFeature: . They take into account the edit capabilities of the service (at the time the geodatabase was generated), and also any Ownership-based access control policies (for eg, can people edit only those features that belong to them, or can they edit other's features too)
0 Kudos
EikeLüders
New Contributor II
Hi Divesh,

thanks for your reply.
Indeed I noticed that the method "canUpdate" returns NO for the geodatabase tables. This fact confuses me, because I am able to edit the features when they are stored in a file geodatabase in ArcMap.

Also the same geodatabase is editable through the Android SDK.

Maybe I have a mistake in the creation process of the geodatabase?
I do this in ArcMap through the "Create Runtime Content"-tool as follows:
Select the tool from "Data management tools" -> "Package" -> "Create Runtime Content". Then I select the mxd which includes the file geodatabase and select an output folder on my disk. All other settings I leave to standard values. Then I copy the generated geodatabase to my XCode project and add it to my map like this:


AGSGDBGeodatabase *geoDB = [[AGSGDBGeodatabase alloc] initWithPath:fullPath error:&error];
            
if (error) {
    NSLog(@"ERR: %@", error);
}
for (AGSGDBFeatureTable* fTable in geoDB.featureTables) {
 if ([fTable hasGeometry]) {
  AGSFeatureTableLayer *featureTableLayer = [[AGSFeatureTableLayer alloc] initWithFeatureTable:fTable];
  NSLog(@"T: %d", fTable.canUpdate);
  featureTableLayer.visible = YES;
  featureTableLayer.delegate = self;
  [self.layers addObject:featureTableLayer];
 }
}
0 Kudos
DiveshGoyal
Esri Regular Contributor
Runtime geodatabases created through ArcMap are not meant to be editable. They are view-only. There are no tools to take a modified runtime geodatabase and pull its changes into a source geodatabase on the desktop or in a database.
0 Kudos
teamIgal
New Contributor III
Runtime geodatabases created through ArcMap are not meant to be editable. They are view-only. There are no tools to take a modified runtime geodatabase and pull its changes into a source geodatabase on the desktop or in a database.


Hi,

Is that mean that even if i will create the geodatabase through the code, and then open it in the ArcMap , then i still won't be able to edit it, save the .geodatabse file, and open it again through the code for editing?

Thanks,
Team Igal
0 Kudos