We are using Dojo framework to develop our portal. We have bound the ArcGIS map in our web portal. Is there any ArcGIS JavaScript API which will accept the path of the shapefile and plot that shapefile directly on map. If it is free API then that will be great and if it is paid API then how can we purchase that?


Simplest solution is to use ArcGIS Online, they allow you to upload and plot your shapefiles.

Though I'm guessing by the way you phrased your question, you want to build the map and interface around it yourself and you don't have ArcGIS for Server. In that case, one way to do it would be to build an intermediate service that takes the uploaded shapefile and converts it to a csv lat/lon. You could easily build something that uses ogr2ogr in gdal... and even build off of what has already been done by the community such as this for example: https://gis.stackexchange.com/a/19178. Once they are in csv, you can create a FeatureLayer in javascript with the data and it will plot on the map. Esri has a nice demo with drag and drop functionality of csv files: https://developers.arcgis.com/javascript/jssamples/exp_dragdrop.html

The other route you could go is use an intermediate service (with ogr2ogr) to convert from your shapefile to GeoJSON. Something like:

ogr2ogr -f GeoJSON data.json data.shp

Once you have GeoJSON, you can plot that on the map... though Esri needs ArcGIS JSON instead of GeoJSON. Esri has already taken care of this for you with the geojson-layer component in their github repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.