Does anyone have sample code for uploading a shapefile client side using the 4.9 javascript api and the esri/request method?
Thank you so much.
Solved! Go to Solution.
Hello Centerline,
I was actually working on a sample that takes the 3.x sample of adding shapefiles to the map (Add Shapefile) and converting it to 4.x. It currently only works when the shapefile has points and not polygons/polylines. I ran into some issues when trying to complete this though...
Like I have said above, I have a working beta for shapefiles that include points. If you would like to use that as a starting point, feel free to let me know and I can send it to you.
Also, you mentioned client-side, the sample would need an Portal or ArcGIS Online for this to work since it uses the Generate operation.
EDIT: Looks like I actually got it to work. Here is the link to the code Sample of add shapefile. You do need AGOL or Portal for this to work. Also you may need the resource proxy to remedy any CORS errors you may get. This sample is based on the 3.x, so a lot of the code from that sample is the same with some changes for 4.x.
Hello Centerline,
I was actually working on a sample that takes the 3.x sample of adding shapefiles to the map (Add Shapefile) and converting it to 4.x. It currently only works when the shapefile has points and not polygons/polylines. I ran into some issues when trying to complete this though...
Like I have said above, I have a working beta for shapefiles that include points. If you would like to use that as a starting point, feel free to let me know and I can send it to you.
Also, you mentioned client-side, the sample would need an Portal or ArcGIS Online for this to work since it uses the Generate operation.
EDIT: Looks like I actually got it to work. Here is the link to the code Sample of add shapefile. You do need AGOL or Portal for this to work. Also you may need the resource proxy to remedy any CORS errors you may get. This sample is based on the 3.x, so a lot of the code from that sample is the same with some changes for 4.x.
Hello Munachiso,
Thank you kindly for your feedback. We are working with polygons so that is good to know. Also, we did notice the query parameter issue. We have AGOL and Portal access. I will take a look at your sample and also the Fetch API and see if this will get working. Thanks again for your feedback.
UPDATE: Munachiso, were you able to get it to work for polygons? Thanks again.
Yes, I have updated the sample and it should work with polygons and polylines.
Thanks Munachiso, I appreciate your expertise.