Select to view content in your preferred language

Feature Constructors in ArcGIS Mobile

1053
3
10-12-2011 01:12 AM
AndrewCorcoran
Deactivated User
I'm having major problems creating new Feature instances using either of the following constructors:

new Feature(FeatureLayerInfo, int)
new Feature(FeatureDataRow)

I want to create an instance from an existing data row so that I can pass it to an EditFeatureAttributesPage to re-edit the feature. This works when going through the normal workflow using the ArcGIS Mobile application but doesn't when I'm doing it programmatically.

I've checked that all the attributes for the feature have a value but I still get either:

"Object reference not set to an instance of an object." in the "SetProperties" method of Feature when usng the first constructor

or

"Value does not fall within the expected range." in the constructor of Feature when using the second constructor

Anyone any ideas what I can do to work out what is going wrong?
0 Kudos
3 Replies
StephenDickinson
Esri Contributor
Hi,

This might not be related.  However, I've experienced problems creating a Feature object from a FeatureDataReader when the feature in question is not symbolised in the map document.  If there is not a specific symbol defined for a feature the "All Other Values" symbolisation needs to be enabled in order to return a valid Feature object.

Thanks,
Steve
0 Kudos
AndrewCorcoran
Deactivated User
Thanks for the reply.

It's definitely not related to that issue though as my feature is a polygon displayed on the map.

I think it may be related to using Guids as attribute values as I've tried my feature class minus all the attributes other than two Guid columns and I still get the same error.
0 Kudos
AndrewCorcoran
Deactivated User
Just to follow up on this in case anyone else is having problems...

I contacted support here in the UK and the only Feature constructor we could get working between us was:

new Feature(FeatureType, null)

and then set all the attributes one by one from a FeatureDataReader for the existing feature, i.e.

Feature f = new Feature(FeatureType, null);
for (Int32 i = 0; i < featureReader.FieldCount; i++)
{
    string columnName = featureReader.GetName(i);
    object o = featureReader[columnName];

    f.FeatureDataRow[columnName] = o;
}

I wrongly assumed that this would create a new row in the dataset each time I just wanted to edit an existing feature. Pretty cumbersome and entirely un-documented (a bug report has been submitted against the documentation).
0 Kudos