Using arcgis js there is a scenario where featurelayer is created with client side features, i want to be able to extract those features for further processing, is it possible to do so?
Note the feature layer is not hosted, and ideally shape file or geojson format would be great.
Solved! Go to Solution.
Hey @MatthewDriscoll , thanks for sharing.
toJSON() doesn't export it to geojson format, it only converts it to an instance of this class to its ArcGIS portal JSON representation per documentation.
However in saying that, I ended up building a transformer that takes toJSON and converts them to geoJSON format.
For geojson you can query the feature you want to extract, get the graphics and use its properties to extract the geojson.
let newGraphic = new GraphicsLayer();
newGraphic.listMode = "hide";
theMap.add(newGraphic);
newGraphic.addMany(results.features);
newGraphic.listMode = "hide";
var graphJSON = []
graphJSON.push(newGraphic.graphics.toJSON())
Hey @MatthewDriscoll , thanks for sharing.
toJSON() doesn't export it to geojson format, it only converts it to an instance of this class to its ArcGIS portal JSON representation per documentation.
However in saying that, I ended up building a transformer that takes toJSON and converts them to geoJSON format.