<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>CSVLayer sample</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.30/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
</style>
<script src="https://js.arcgis.com/3.30/"></script>
<script>
var map, csv;
require([
"esri/map",
"esri/layers/CSVLayer",
//"esri/Color",
"dojo/_base/Color",
"esri/symbols/SimpleMarkerSymbol",
"esri/renderers/ClassBreaksRenderer",
"esri/InfoTemplate",
"esri/config",
"dojo/domReady!"
], function(
Map, CSVLayer, Color, SimpleMarkerSymbol, ClassBreaksRenderer, InfoTemplate, esriConfig
) {
// Use CORS
//esriConfig.defaults.io.corsEnabledServers.push("earthquake.usgs.gov"); // supports CORS
// Use proxy if the server doesn't support CORS
esriConfig.defaults.io.proxyUrl = "/proxy/";
map = new Map("map", {
basemap: "streets",
center: [-85.25, 37.96],
zoom: 8
});
csv = new CSVLayer("KY_NOX.csv", { //local csv file
copyright: "ky.gov"
});
var symbol = new SimpleMarkerSymbol();
//symbol.setColor(new Color([150, 150, 150, 0.9]));
var renderer = new ClassBreaksRenderer(symbol, "${total_emissions}");
renderer.addBreak(0.0, 10.0, new Color([0, 200, 0, .5]));
renderer.addBreak(10.0, 100.0, new Color([0, 0, 200, .5]));
renderer.addBreak(100.0, Infinity, new Color([168, 168, 168, 1]));
var template = new InfoTemplate();
template.setTitle("<b> EIS Site ID </b>: ${eis_facility_site_id}");
template.setContent("<b>Facility</b>: ${facility_site_name} </br>"+"<b>County </b>: ${county_name} </br>" + "<b> Total Emissions </b>: ${total_emissions} Tons </br>" + "<b> Unit Type </b>: ${unit_type}");
csv.setInfoTemplate(template);
csv.setRenderer(renderer);
map.addLayer(csv);
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>