Select to view content in your preferred language

Export Featureset to Hosted Feature Layer using ArcGIS JavaScript

234
4
09-30-2024 11:55 AM
dgreenin
Emerging Contributor

Is it possible to export a featureset (resulting from a query) to a hosted feature layer in ArcGIS Online and/or an ArcGIS Enterprise Portal using ArcGIS JavaScript?

0 Kudos
4 Replies
JamesIng
Regular Contributor

Potentially just need some clarification about what you're trying to do.
You can do a query against a feature layer and then just pipe those results into an ApplyEdits against another layer in your AGOL or Enterprise using Javascript if that's what you're asking.

James from www.landkind.com
0 Kudos
dgreenin
Emerging Contributor

@JamesIng Great mention.

It would be of interest to create a new hosted feature layer containing a featureset resulting from a query (in this case a spatial query).

If it is not possible to create a new hosted feature layer using ArcGIS JavaScript, using ApplyEdits to capture the resulting featureset would be of interest as well.

0 Kudos
JamesIng
Regular Contributor

If you want to create a brand new feature layer or service you can't do that directly through the Javascript API.

Instead you'll want to use the REST API.

https://developers.arcgis.com/rest/users-groups-and-items/create-service/


Once you have a hosted service you can then do a spatial query and do an applyEdits using the Javascript API from that query to your new service.

Apply Edits
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdi...

James from www.landkind.com
0 Kudos
dgreenin
Emerging Contributor

@JamesIng 

Thank you for the resources!

What might it look like to utilize the REST API within an ArcGIS JavaScript application to create a new hosted feature layer? Do you happen to have an example?

0 Kudos