How to publish a newly created FeatureLayer to ArcGIS Online

299
2
Jump to solution
12-16-2019 07:38 AM
JonM_
by
New Contributor II

In my code, I have created a new FeatureLayer using client-side graphics:

var fl = new FeatureLayer({
   source: array_of_Graphics_Objects,
   ...
});‍‍‍‍

map.add(fl);

The FeatureLayer is created and displaying successfully in the MapView. I would now like to publish it to my ArcGIS Online account so the contents are saved as a hosted FeatureLayer. Any help on how to go about this would be appreciated.

Thank you.

0 Kudos
1 Solution

Accepted Solutions
Noah-Sager
Esri Regular Contributor

We currently do not have this functionality with the 4x version of the JS API. Soon we will have the ability to save webmaps. You can test this out with the js-next:

feedback-js-api-next/CHANGELOG.md at master · Esri/feedback-js-api-next · GitHub 

View solution in original post

0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor

We currently do not have this functionality with the 4x version of the JS API. Soon we will have the ability to save webmaps. You can test this out with the js-next:

feedback-js-api-next/CHANGELOG.md at master · Esri/feedback-js-api-next · GitHub 

0 Kudos
JonM_
by
New Contributor II

Thank you very much. This may be a bit outside the scope of this question, but I believe I can mimic the functionality I'm looking for by using the arcgis-rest-js modules to createItem() in create a new feature layer in ArcGIS Online, then use the javascript api's featureLayer.applyEdits() functionality to add in Graphics objects as new features. Can you/anyone confirm if this could work as intended?

0 Kudos