Hide Table of Contents
View Analysis - Create watersheds sample in sandbox
Analysis - Create watersheds


Create Watersheds determines the watershed, or catchment areas, for each point in your input layer. A points watershed includes all areas upstream that contribute to the flow of water to that point.

Since not all points are located within drainages, the resulting watersheds may be very small when the exact location of the input points are used in the calculation. If this is the case with your input points, you can make your analysis more meaningful by setting a search distance. This will adjust the location of each point so they intersect the nearest drainage within the specified search distance. Using this option does not modify the actual locations of your input points.

The generated result is a group layer containing two layers: a polygon layer representing watersheds and a point layer with the adjusted points used in computation.

Each watershed feature will contain all the attributes of its corresponding point input.

Create Watersheds is part of the Analysis service in ArcGIS Online.Analysisis a subscription-based service available through ArcGIS Online. Log-in credentials are always required when executing an Analysis task. Please supply your own credentials to use this sample.


<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
<link rel="stylesheet" href="https://js.arcgis.com/3.20/dijit/themes/claro/claro.css" />
<link rel="stylesheet" href="https://js.arcgis.com/3.20/esri/css/esri.css" />
  html, body, #border-container
    height: 100%;
    margin: 0;
  /* Don't display the analysis widget's close icon*/
  .esriAnalysis .esriAnalysisCloseIcon
    display: none;
<script src="https://js.arcgis.com/3.20/"></script>
    ], function (
    ) {
        ready(function () {

                urlPrefix: "elevation.arcgis.com",
                proxyUrl: "/sproxy/"

            var map = new Map("map", {
                basemap: "topo",
                center: [-117.202097,34.067219],
                zoom: 12

            var featureLayer = new FeatureLayer("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/origins/FeatureServer/0");

            var analysisTool;
            map.on("layers-add-result", function () {

                analysisTool = new CreateWatersheds({
                    inputLayers: [ featureLayer ],
                    searchUnits: "Feet",
                    portalUrl: "https://www.arcgis.com",
                    map: map,
                    returnFeatureCollection: true
                }, "toolPane");
                analysisTool.on("job-result", function (result) {
                    analysisTool.set("disableRunAnalysis", false);
                    var resultLayer = new FeatureLayer(result.value.url || result.value, {
                        outFields: ['*'],
                        infoTemplate: new InfoTemplate()
<body class="claro">
  <div id="border-container" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline',gutters:false">
    <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="padding: 0;"></div>
    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left'" style="width: 300px;">
      <div id="toolPane"></div>