Select to view content in your preferred language

FeatureSet toJson

372
2
01-24-2013 08:19 AM
MilesWacker
Emerging Contributor
The application I'm working on captures the users attribute edits in a graphic object that is then pushed into a FeatureSet.  Then that FeatureSet is converted to JSON using FeatureSet.toJson method.

If I have a FeatureSet with no Geometry, the method returns a null pointer exception.

But if there is a geometry in there it has no problem.

What is is going on?  Shouldn't the FeatureSet.toJson method work even if I do not have geometry?

My current workaround is to pass in the existing geometry, but that seems totally inefficient, when I send the updates it will send the geometry and attributes, all I need to send is the attribute updates...  I guess I'll need another workaround to pull only the attributes to that featureSet before it is pushed to the server.
0 Kudos
2 Replies
AndyGup
Esri Regular Contributor
I agree that doesn't sound right. If there's no geometry I thought the featureSet would be treated as a Table. My recommendation is for you to open a support ticket to get the issue logged.

As a temporary work-around maybe you can assign a mock geometry to the Graphic and then flag it with a boolean attribute that let's your code know it's using a mock geometry...

-Andy
0 Kudos
MilesWacker
Emerging Contributor
Thanks Andy, I'll log a ticket.  I guess I'm not sure where to log it, could you point me in the right direction?

My workaround is just to pump the features geometry back into the feature set with the edited attributes and write that to json, then when the user is ready to apply edits to the service, I strip out the geometry and just apply the attribute edits.  It works well.
0 Kudos