1

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>

3

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.