Import Data using javascript API 4.15

662
3
05-18-2020 07:22 AM
deleted-user-VQ40NmU7Vt6N
New Contributor II

Hello

I am trying import a shapefile from my local machine to mi ArcGis account using javascript API, but I have not found documentation of this.

Does anyone know a simple code or a code to do this?

I do not think of anyone of ESRI developers have not idea how doing this.

Please some help will very helpfull

Tags (1)
0 Kudos
3 Replies
AndrewVitale
New Contributor III

Are you trying to add features into an existing Feature Class on Portal/AGOL, or create a brand new item with the shapefile? If the latter, I'm not sure if you can do it or not. If the former, I' had good luck with this sample from Esri: Create a FeatureLayer from a shapefile | ArcGIS API for JavaScript 4.15 

The sample will show you how to get the file attached to a form's input field, submit the file to AGOL (or portal) using the /features/generate endpoint to transform the shapefile to a JS API compatible object, then transform it to a feature layer. From there, you'll have the data in the JS API and can add/update/delete whatever needs it.

Hope that helps.

0 Kudos
deleted-user-VQ40NmU7Vt6N
New Contributor II

Hello Andrew

Thanks for your help, but I am looking for import/upload data into mi ArcGIS account (ArcGIS online), I mean save it in there for using after later.

Thanks anywhere

0 Kudos
AndrewVitale
New Contributor III

No worries, sorry I missed the mark. If you come up with a solution, please share it here. I'm also interested.

0 Kudos