Hello! Me and my friend are currently working on project using JS with Arcgis API and have two questions.
1. How do you create a completely new empty layer that you can add geometries to in Arcgis js api?
2. Where should this new layer be saved? Is it a database or something like a catalog that i've read about?
Really enjoying the project so far and want to thank in advance for the help! :)
If you goal is to allow someone to draw new features (e.g. lines, polygons, or points) on the map, you would need to add either a GraphicsLayer or a Feature Layer to your map. The following samples will likely help you get started:
However, if your goal is to save them, the easiest option is to create a Hosted Feature Layer in ArcGIS Online. You can then read and save your changes to this Hosted Feature Layer.
To do this, you will need an ArcGIS Online account. If you do not already have such an account, you can sign-up for a free developer account at https://developers.arcgis.com/ which will provide you with a small amount of storage to get started.
Once on the developer site with an account, you can create a hosted feature layer by going to the Layers section, then + Create data and choosing the New hosted layer (Feature layer) option. The page will then walk you through creating a new hosted feature layer.
If you want to allow the end user to edit the features (e.g. add a new polygon), you will find instructions in the Edit feature data tutorial.
Best of luck and have fun!