Create Viewshed

Create Viewshed task

This task uses an elevation surface and observer locations to identify areas where the observers can see the observed objects and the observed objects can see the observers.

Request URL

http://<raster analysis url>/CreateViewshed/submitJob

Request Parameters

Following is the list of parameters with syntax and details for each.

Parameter

Description

inputElevationSurface

(Required)

The input elevation surface for calculating viewshed.

Syntax: This parameter can be specified as a Portal Item ID, a URL to a raster image service layer, or a cloud raster dataset.

Examples:

  • "inputElevationSurface": {"itemId": <portal item id>}
  • "inputElevationSurface": {"url": <image service layer url>}

inputObserverFeatures

(Required)

The input observer locations features.

Syntax: This parameter can be specified as:

  • a URL to a feature service layer with an optional filter to select specific features
  • a feature collection

Examples:

  • "inputObserverFeatures": {"url": <feature service layer url>, "filter": <where clause>}
  • "inputObserverFeatures": {"layerDefinition": {}, "featureSet": {}, "filter": <where clause>}

outputName

(Required)

This is the output image service name that will be created.

Syntax: A JSON object describes the name of the output or the output raster.

You can specify the name or you create an empty service using Portal Admin Sharing API and use the return JSON object as input to this parameter.

Output name example:

"outputName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster example:

"outputName":{"itemId": <portal item id>}
"outputName":{"url": <image service url}
"outputName":{"serviceProperties":{"name":"testrasteranalysis","serviceUrl":"http://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"}, "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b","folderId":"sdfwerfbd3ec25584d0d8f4"}}

optimizeFor

Choose the optimization method to use for calculating the viewshed.

Syntax: A string describing the optimization method, which can be one of the following:

  • SPEED — The method used to calculate the viewshed is optimized for processing speed, trading some accuracy in the result for higher performance. This is the default.
  • ACCURACY — The method used to calculate the viewshed is optimized for accuracy, at the expense of a longer processing time.

Example:

  • "optimizeFor": "ACCURACY"

maximumViewingDistance

This is a cutoff distance where the computation of visible areas stops. Beyond this distance, it is unknown whether the analysis points and the other objects can see each other.

The value must be supplied through either the maximumViewingDistance parameter or the maximumViewingDistanceField parameter.

Syntax: A linear unit specifying the distance and units.

Supported units: Meters, Kilometers, Feet, Yards, Miles

Example:

  • "maximumViewingDistance": {"distance": <value>, "units": <unit>}

maximumViewingDistanceField

Provide a field that specifies the maximum viewing distance for each observer. You can use any numerical field from the input observer point features.

The value contained in the field must be in the same unit as the XY unit of the input elevation surface.

Syntax: A string that represents a field name.

Example:

  • "maximumViewingDistanceField": "radius2"

minimumViewingDistance

This is a distance where the computation of visible areas begins. The value must be supplied through either the minimumViewingDistance parameter or the minimumViewingDistanceField parameter.

Syntax: A linear unit specifying the distance and units.

Supported units: Meters, Kilometers, Feet, Yards, Miles

Example:

  • "minimumViewingDistance": {"distance": <value>, "units": <unit>}

minimumViewingDistanceField

Provide a field that specifies the minimum viewing distance for each observer.

You can use any numerical field from the input observer point features. The value contained in the field must be in the same unit as the XY unit of the input elevation surface.

Syntax: A string that represents a field name.

Example:

  • "minimumViewingDistanceField": "radius1"

viewingDistanceIs3D

Specify whether the minimumViewingDistance and maximumViewingDistanceinput parameters are measured in a three-dimensional or two-dimensional way.

Syntax: A boolean value as either true or false. If it is true, the viewing distances are measured in 3D. If it is false, the viewing distances are measured in 2D.

Default: false

observersElevation

Specify the elevation of your observer locations.

The value must be supplied through either the observersElevation parameter or the observersElevationField parameter.

Syntax: A linear unit specifying the elevation and units.

Supported units: Meters, Kilometers, Feet, Yards, Miles

Example:

  • "observersElevation": {"distance": <value>, "units": <unit>}

observersElevationField

Provide a field that specifies the elevation for the observers.

You can use any numerical field from the input observer point features. The value contained in the field must be in the same unit as the Z unit of the input elevation surface.

Syntax: A string that represents a field name.

Example:

  • "observersElevationField": "spot"

observersHeight

The height above ground of your observer locations.

The value must be supplied through either the observersHeight parameter or the observersHeightField parameter. During the viewshed calculation, this value is added to the observer elevation if it is specified; otherwise, it is added to the interpolated surface z-value.

Syntax: A linear unit specifying the height and units.

Supported units: Meters, Kilometers, Feet, Yards, Miles

Example:

  • "observersHeight": {"distance": <value>, "units": <unit>}

observersHeightField

Provide a field that specifies the height for the observers. You can use any numerical field from the input observer point features.

The value contained in the field must be in the same unit as the Z unit of the input elevation surface.

Syntax: A string that represents a field name.

Example:

  • "observersHeightField": "offseta"

targetHeight

Enter the height of structures, or people on the ground, used to establish visibility.

The value must be supplied through either the targetHeight parameter or the targetHeightField parameter.

Syntax: A linear unit specifying the height and units.

Supported units: Meters, Kilometers, Feet, Yards, Miles

Example:

  • "targetHeight": {"distance": <value>, "units": <unit>}

targetHeightField

Provide a field that specifies the height for the targets. You can use any numerical field from the input observer point features.

The value contained in the field must be in the same unit as the Z unit of the input elevation surface

Syntax: A string that represents a field name.

Example:

  • "targetHeightField": "offsetb"

aboveGroundLevelOutputName

The optional above ground level output image service name.

Syntax: A JSON object describes the name of the output or the output raster.

You can specify the name or you create an empty service using Portal Admin Sharing API and use the return JSON object as input to this parameter.

Output name example:

"aboveGroundLevelOutputName":{"serviceProperties":{"name":"testagl"}}

Output raster example:

"aboveGroundLevelOutputName":{"itemId": <portal item id>}
"aboveGroundLevelOutputName":{"url": <image service url}
"aboveGroundLevelOutputName":{"serviceProperties":{"name":"testagl","serviceUrl":"http://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"}, "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b","folderId":"sdfwerfbd3ec25584d0d8f4"}}

context

Context contains additional settings that affect task execution.

For this tool, there are five settings.

  • Extent (extent) — a bounding box that defines the analysis area. Only those areas in the inputZoneLayer that intersect the bounding box will have the statistics calculated.
  • Output Spatial Reference (outSR) — the output raster will be projected into the output spatial reference.
  • Snap Raster (snapRaster) — the output raster will have its cells aligned with the specified snap raster.
  • Cell Size (cellSize) — the output raster will have the resolution specified by cell size
  • Mask (mask) — only cells that fall within the analysis mask will be considered in the operation.

f

The response format. The default response format is html.

Values: html | json

Response

When you submit a request, the task assigns a unique job ID for the transaction.

Syntax:

{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted you can use the jobId to periodically check the status of the job and messages as described in the topic Checking job status. Once the job has successfully completed, you use the jobId to retrive the results. To track the status, you can make a request of the following form:

http://<raster analysis url>/CreateViewshed/jobs/<jobId>

Accessing results

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

http://<raster analysis url>/jobs/<jobId>/results/outputRaster?token=<your token>&f=json

Parameter

Description

outputRaster

This is the output viewshed raster item ID and URL.

Example:

{"url": 
"http://<raster analysis url>/CreateViewshed/jobs/<jobId>/results/outputRaster"}

The result has properties for parameter name, data type, and value. The contents of value is always the output raster dataset's itemid and the image service URL. For example:

{
    "paramName": "outRaster",
    "dataType": "GPString",
    "value": {
        "itemId": "f121390b85ef419790479fc75b493efd", 
        "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
    } 
}

outputAboveGroundLevelRaster

The output above ground level raster item ID and URL.

Example:

{"url": 
"http://<raster analysis url>/CreateViewshed/jobs/<jobId>/results/outputAboveGroundLevelRaster"}

The result has properties for parameter name, data type, and value. The contents of value is always the output raster dataset's itemid and the image service URL. For example:

{
    "paramName": "outRaster",
    "dataType": "GPString",
    "value": {
        "itemId": "f121390b85ef419790479fc75b493efd", 
        "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
    } 
}

Related topics

10/6/2017