Add Shapefile in JS 4.2

5961
10
02-14-2017 09:32 AM
BrandonPayne
New Contributor II

I'm wondering if anyone has been able to add a shapefile to a JS 4.2 app yet?  I see the documentation for doing it in 3.19 (Add shapefile | ArcGIS API for JavaScript 3.19 ) and I've gotten this to work as a local demo project, but there are a few changes from 3.x to 4.x that seem to make this quite hard to do.  Specifically, the esri/request has changed to no longer use a "form" parameter, so how do we upload the zipped shapefile now?  

Ideally, I'd like to be able to add an in-memory instance of a shapefile from a database download as well as a user selected shapefile from their local machine.  Anyone have some ideas on this? I'm starting to lean toward a third-party tool to parse out the geojson data from the shapefile and manually add in a new feature layer, but this seems like more work than should be necessary.

10 Replies
ChandrikaMedapati
New Contributor

Hi Brandon, Thanks for the solution it works for me to add the shape data as a feature Layer in ESRI (4.x) I would like to know, is there any chance of getting the URL of the feature Layer which we have created through shape data? 

(OR) is there any chance of converting this feature Layer/shape data data into geojson format?

Can you please help me out !! Thanks In Advance!

0 Kudos