Is it possible to get the GeoJson representation of a GPFeatureRecordSetLayer that is returned from GPServer task?

I am able to draw the feature on the map (using the ArcGIS js API) with code like this:

const polygon_feature = data.value.features[0];
polygon_feature.symbol = fillSymbol;

where data is a returned promise from the .getResultData() method implemented in the ArcGIS API.

Is there any method available to get the geometry from this object so I can pass it to my backend and save it to our database as GeoJSON or wkt?


There are probably methods in JS to convert or cast the feature set to JSON. (If this is the route you need to go, perhaps someone else will provide that answer).

However if your server is 10.5 or newer, you can request the output as geoJSON By using f=geojson as an alternative.

REST Reference

Essentially, use which method makes most sense for your workflow - converting the JS result to JSON or ask for the result to be sent as JSON in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.