Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!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>Simple Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.23/esri/css/esri.css">
<!--<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.23/esri/dijit/analysis/ExtractData.css"/>-->
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.23/esri/css/widgets-1.css"/>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.23/esri/css/widgets-2.css"/>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.23/esri/css/widgets-3.css"/>
<style>
html, body, #map {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://js.arcgis.com/3.23/"></script>
<script>
var map;
require([
"dojo/on",
"esri/config",
"esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/dijit/analysis/ExtractData",
"esri/geometry/Extent",
"esri/tasks/Geoprocessor",
"dojo/domReady!"
], function(on, esriConfig, Map, ArcGISDynamicMapServiceLayer, FeatureLayer, ExtractData, Extent, Geoprocessor) {
esriConfig.defaults.io.corsEnabledServers.push('maps.ngdc.noaa.gov');
esriConfig.defaults.io.corsEnabledServers.push('gis.ngdc.noaa.gov');
esriConfig.defaults.io.corsEnabledServers.push('gisdev.ngdc.noaa.gov');
var aoi = new Extent(-44, -9, -41, 0);
console.log(aoi.toJson());
map = new Map("map", {
basemap: "topo", //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
center: [-122.45, 37.75], // longitude, latitude
zoom: 6
});
var layer = new ArcGISDynamicMapServiceLayer(
"https://gis.ngdc.noaa.gov/arcgis/rest/services/web_mercator/hazards/MapServer",{
id: 'natural hazards'
}
);
map.addLayer(layer);
var layers = [
new FeatureLayer("https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/MapServer/0", {
id: 'Retrospective DART Deployments'
}),
new FeatureLayer("https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/MapServer/1", {
id: 'Current DART Deployments'
}),
new FeatureLayer("https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/MapServer/2", {
id: 'Volcano Locations'
}),
new FeatureLayer("https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/MapServer/3", {
id: 'Signifigant Earthquakes'
}),
new FeatureLayer("https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/MapServer/4", {
id: 'Tsunami Observations'
}),
new FeatureLayer("https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/MapServer/5", {
id: 'Tsunami Events'
})];
map.addLayers(layers);
on(this.map, 'layers-add-result', function () {
console.log('layers added');
var extractData = new ExtractData({
featureLayers: layers,
map: map,
analysisGpServer: "https://gisdev.ngdc.noaa.gov/arcgis/rest/services/extract/hazards_extract/GPServer"
}, "analysis-tool");
extractData.startup();
});
console.log('here');
});
</script>
</head>
<body>
<div id="map"></div>
<hr>
<br>
<div id="analysis-tool"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment