FeatureTable.AddFeatureAsync Fail if table not have Z and Point does

713
2
Jump to solution
12-29-2020 09:46 AM
JoeHershman
MVP Regular Contributor

I noticed something which to me does not make sense as an exception.

We have a table that is defined to not have Z coordinate.

We normally collect points from a GPS device which just returns lat/lon so normally create points without Z.

I recently was testing the app using the SystemLocationDataSource which does return X,Y,Z coordinates.  When calling FeatureTable.AddFeatureAsync it fails because the table does not have a z coordinate.

Why?  Why would the Z not simply be removed when the point is added.  Instead I am having to write conditionals to remove Z from the points

Thanks,
-Joe
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

I think we chose to throw an exception because if the API silently dropped the Z value, then you could consider data is being lost or corrupted. Instead we wanted to guide the developer to consciously choose to remove Z values, or alternatively knowing that they could or should be capturing Z values then ensure the data schema allows for this (and set appropriate default Z value, etc).

The overhead of checking if the table supports Z values, if the feature has a Z value, and using GeometryEngine to remove them should be negligible, but if you see any issues please let us know.

View solution in original post

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

I think we chose to throw an exception because if the API silently dropped the Z value, then you could consider data is being lost or corrupted. Instead we wanted to guide the developer to consciously choose to remove Z values, or alternatively knowing that they could or should be capturing Z values then ensure the data schema allows for this (and set appropriate default Z value, etc).

The overhead of checking if the table supports Z values, if the feature has a Z value, and using GeometryEngine to remove them should be negligible, but if you see any issues please let us know.

0 Kudos
JoeHershman
MVP Regular Contributor

Ok, now that I see the GeometryEngine method its not too bad, I was stripping it myself which was somewhat ugly

Thanks,
-Joe
0 Kudos