generated from bcurl21/my-second-webpage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
61 lines (52 loc) · 1.58 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require([
"esri/Map",
"esri/layers/CSVLayer",
"esri/views/MapView",
"esri/config",
"esri/core/urlUtils",
"dojo/domReady!"
], function(
Map,
CSVLayer,
MapView,
esriConfig,
urlUtils
) {
// If CSV files are not on the same domain as your website, a CORS enabled server
// or a proxy is required.
var url = "https://developers.arcgis.com/javascript/latest/sample-code/layers-csv/live/earthquakes.csv";
esriConfig.request.corsEnabledServers.push('https://rawgit.com');
// Paste the url into a browser's address bar to download and view the attributes
// in the CSV file. These attributes include:
// * mag - magnitude
// * type - earthquake or other event such as nuclear test
// * place - location of the event
// * time - the time of the event
const template = {
title: "Earthquake Info",
content: "Magnitude {mag} {type} hit {place} on {time}."
};
const csvLayer = new CSVLayer({
url: url,
copyright: "USGS Earthquakes",
popupTemplate: template
});
var symbol = {
type: "simple-marker",
color:"yellow"
};
csvLayer.renderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: symbol
};
var map = new Map({
basemap: "gray",
layers: [csvLayer]
});
var view = new MapView({
container: "viewDiv",
center: [0, 0],
zoom: 2,
map: map
});
});