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>
-
This may help: gis.stackexchange.com/questions/49396/…PolyGeo– PolyGeo ♦2014年06月29日 21:27:40 +00:00Commented Jun 29, 2014 at 21:27
-
1can you do it in api esri 4.4? please i need this solution for the version 4.4 Thx.Giancarlo Bruno Honores– Giancarlo Bruno Honores2017年09月19日 15:22:18 +00:00Commented Sep 19, 2017 at 15:22
-
This link has some addEventListener example that can be used with the newer version swaggypyang.github.io/arcgisapi/sdk/latest/sample-code/…ncelik– ncelik2022年03月30日 17:27:31 +00:00Commented Mar 30, 2022 at 17:27
1 Answer 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