[GIS] How to upload a csv file into esri map with coordinates and plot in an esri map

arcgis-javascript-apicsv

I have got a sample code to plot the points on an esri map using a csv file.
But the csv file is maintained in a server, i'm unable to upload it from my local system.Please let me know how i can refer the csv file in my local system and plot the coordinates?

Simple Map

html, body, #map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}

var map, csv;

  require([
    "esri/map", 
    "esri/layers/CSVLayer",
    "esri/Color",
    "esri/symbols/SimpleMarkerSymbol",
    "esri/renderers/SimpleRenderer",
    "esri/InfoTemplate",
    "esri/urlUtils",
    "dojo/domReady!"
  ], function(
    Map, CSVLayer, Color, SimpleMarkerSymbol, SimpleRenderer, InfoTemplate, urlUtils
  ) {
   urlUtils.addProxyRule({
      proxyUrl: "/proxy",
      urlPrefix: "earthquake.usgs.gov"
    });
    map = new Map("map", {
      basemap: "gray",
      center: [ -60, -10 ],
      zoom: 4 
    });
    csv = new CSVLayer("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.csv", {
      copyright: "USGS.gov"
    });
    var orangeRed = new Color([238, 69, 0, 0.5]); // hex is #ff4500
    var marker = new SimpleMarkerSymbol("solid", 15, null, orangeRed);
    var renderer = new SimpleRenderer(marker);
    csv.setRenderer(renderer);
    var template = new InfoTemplate("${type}", "${place}");
    csv.setInfoTemplate(template);
    map.addLayer(csv);
  });
</script>

Best Answer

there is a published sample in the ArcGIS API for JavaScript Resource Center which demonstrates how end users can browse for a file on disc and plot it interactively.

Drag and drop to display data https://developers.arcgis.com/javascript/jssamples/exp_dragdrop.html

Related Question