My client wants a Geospatial web application in which they need a facility to upload their shape file and view the same on top of map. So uploading the shapefile in ArcGIS.com will not work in my case. So please advise me how I can create the same functionality of ArcGIS.com using ArcGIS api for javascript.
Hi Solid Smoke,Did you ever find a solution for adding shapefiles using javascript api??Thanks,-Swapna
It can be done. It would be easier as json/geojson/csv, but it is doable. Here is a library that was written in js to do it: https://github.com/RandomEtc/shapefile-js.Basically, you are going to have to read it and make graphics from the data in the shapefile. It may run a little slowly and will probably cause issues in IE if it is not fast enough since the javascript engine does not have the performance of the other browsers. Hope this helps.
Hi Heming
I realize this post is very old now, but I am trying to append a shapefile to an existing feature layer also. Can you give me some more information on how you did that?
Thanks
Emily
an another option is to create a geoprocessing service on your Server to do it.
The script will have as input parameter zip file with the Shapefile contents.
the input zip will extracted and then you can load the data on a feature class.
The feature class will be output parameter in order to take the shapefile data as graphics using javascript.
here is a code example for
#extract the zip
zf = zipfile.ZipFile(inShpZip)FeaturesPath = arcpy.env.scratchFolder + "/zipSHPExtract" zf.extractall(FeaturesPath)
#find the shp shpFilesFromZip = glob.glob(FeaturesPath + "/*.shp")
#copy Features
outFeatures = arcpy.env.scratchGDB + "/outFeatures1" arcpy.CopyFeatures_management(shpFilesFromZip[0], outFeatures)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.