I am creating a new feature on my geodatabase feature table,
Feature feature = geodatabaseFeatureTable.createFeature(attributes, geometry);
on success of creation, attributes what I am passing is not showing up, when I do,
feature.getAttributes()
it shows only attributes that I have configured in feature layer while creation.
How do I achieve adding my custom attribute to the feature !
It is really blocking my whole design. Suggestion pls
How are you adding your attributes? Do they properly match the specification of your feature schema?
This doc might help:https://developers.arcgis.com/android/latest/guide/edit-features.htm
There is also a sample showing this working: https://developers.arcgis.com/android/latest/java/sample-code/add-features-feature-service/
Let me know if this helps.
This is how I am doing,
geodatabaseFeatureTable.addDoneLoadingListener(new Runnable() { @Override public void run() { Feature feature = geodatabaseFeatureTable.createFeature(attributes, geometry); final ListenableFuture<Void> voidListenableFuture = geodatabaseFeatureTable.addFeatureAsync(feature); voidListenableFuture.addDoneListener(new Runnable() { @Override public void run() { try { voidListenableFuture.get(); final ListenableFuture<FeatureQueryResult> addFeatureFuture = geodatabaseFeatureTable.getAddedFeaturesAsync(); } });
This method receives the attributes this way,
Map<String, Object> attributes = new HashMap(); attributes.put("GeometryId", GeometryId); attributes.put("FID", FID);
And these attributes are not part of feature schema, I am adding it newly. [ Can we only update the existing attributes !! ]
I just need to put some attributes to my feature to identify and do some manipulation. Kind of session attribute is what I need.
You are working with a feature service which will have a set schema. The service will be backed by a relational database which has tables which contain fields which will map to the attributes in your feature. If an attribute doesn't exist in the feature, then you can't add them. This is how databases work; you can't change the schema at run-time.
You should probably take a step back and think about what you are trying to do exactly. Can you design a feature service which has the correct attributes?
If your data is only needed for the duration of your application running and doesn't need to be persisted on a server / database then you could consider using Graphics which are stored in GraphicsOverlays. These are totally flexible and you can add whatever attributes you like, but they are not persisted after your application stops unless you write your own logic for this.
Information on Graphics and GraphicsOverlays:
https://developers.arcgis.com/android/latest/guide/add-graphics-overlays-to-your-app.htm
https://developers.arcgis.com/android/latest/guide/add-graphics-and-text-to-graphics-overlays.htm