gridMathAnalyst


URI

<dataset_uri>/mathanalyst[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

dataset

Child resources

gridMathResult

Introduction

The MathAnalyst resource. It provides mathematical operations and functions on one or more grid datasets.

Grid algebraic operation idea is to use algebra view of characteristics of geographical phenomena and spatial analysis. Essentially, it conducts the mathematical operation and functional operation for multiple raster datasets.

The calculation of grid algebraic operations contain the following two methods:

Basic operation includes plus, minus, multiply, divide, toInt and toFloat. Use these methods can complete arithmetic operations with one or more of the grid data corresponding grid values. For simple operations, you can call these methods to implement, such as (A/B)-(A/C).

2. This class also supports 21 common types of functions which can be divided into five categories, as shown in the figure below:

The operation expression should follows the following rules:

1. The mathematical expression should be a string formatted as below:

[DatasourceAlias1.Raster1] + [DatasourceAlias2.Raster2]

"[DatasourceName.DatasetName]" should be used to specify the grid dataset for the operation.

2. A mathematical operation on grid datasets can contain arithmetic operators ("+", "-", "*", "/"), conditional operators (">", ">=", "<", "<=", "<>", "=="), logical operators ("|", "&", "Not()", "^"), and some common mathematical functions ("abs()", "acos()", "asin()", "atan()", "acot()", "cos()", "cosh()", "cot()", "exp()", "floor()", "mod(,)", "ln()", "log()", "pow(,)", "sin()", "sinh()", "sqrt()", "tan()", "tanh()", "Isnull()", "Con(,,)").

3. Functions can be nested in a mathematical expression. Operations with conditional operators (e.g., greater than, less than) generates a grid dataset with binary values. The cells that meet the condition have the value 1, and the others have the value 0. The Con(,,) function can be used if other values are to be used to represent values meeting and not meeting the condition. For example, "Con(IsNull([SURFACE_ANALYST.Dem3] ) ,100,Con([SURFACE_ANALYST.Dem3] > 100,[SURFACE_ANALYST.Dem3] ,-9999) ) ". The example expression means: In the grid dataset Dem3 which is in the datasource with the alias SURFACE_ANALYST, the cells with no data are assigned 100. In the rest of the cells, the cell values greater than 100 will not be changed, and the cell values less than or equal to 100 are changed to -9999.

4. If there are negative values in the grid operation, parentheses must be used. For example, [DatasourceAlias1.Raster1] - ([DatasourceAlias2.Raster2]).

5. In the expression, the operations of operators can be a raster dataset, or number or math function.

6. The independent variable of math function can be the expression of a value, a dataset, or multiple datasets.

7. The expression must be the single expression without enter.

8. The expression should be contain a input raster dataset.

Note:

Supported Methods:

Supported output formats: rjson, json, html, xml.

Resource hierarchy

HTTP request methods

Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.

http://supermapiserver:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst/datasets/JingjinTerrain%40Jingjin/mathanalyst.rjson

GET request

Gets the form to calculate the grid algebraic operation.

POST request

Perform grid operation through inputing operation expression.

Request parameter

Parameters passed in the request body are as follows:

Name Type Description
expression String [Required]
The specified grid expression operation, such as:
[DatasourceAlias1.Raster1]*2-10
extractRegion Geometry The specified effective operation region.
If not, the entire region will be computed. If the extents of those datasets are not identical the computing region the the intersection region of those datasets.
isZip boolean Whether to compress the result dataset. Default is False, representing don't compress.
ignoreNoValue boolean Whether to ignore cells with no data. Default is False.
targetDatasource String Datasource for storing the output datasets.
resultGridName String The specified result dataset.
deleteExistResultDataset boolean Whether to delete the existing dataset if the specified result dataset name is identical to the name of an existing dataset. Default as false, as in do not delete.

Response structure

Normal response code(s): 201. The response parameters are as follows:

Field Type Description
succeed Boolean Whether the analysis is successful.
newResourceID String The ID for the analysis result resource.
postResultType PostResultType The result type fo the POST request.
newResourceLocation String The URI of the newly created resource.

Response example

Implement the POST request on the gridMathAnalyst resource http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst/datasets/JingjinTerrain@Jingjin/mathanalyst.rjson. The returned rjson is as follows:

{

    "expression": "[Jingjin.JingjinTerrain]*2-10",

    "isZip": false,

    "ignoreNoValue": false,

    "targetDatasource": "Jingjin",

    "resultGridName": "test1",

    "deleteExistResultDataset": true

}

The response result in rjson format returned is as follows:

{

    "succeed": true,

    "newResourceID": "6b7fe42a934c49fa93fe5b8b7541d2db_5fe86d5324c74d4e88344c29ca89f36f",

    "postResultType": "CreateChild",

    "newResourceLocation": "http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst/datasets/JingjinTerrain@Jingjin/mathanalyst/6b7fe42a934c49fa93fe5b8b7541d2db_5fe86d5324c74d4e88344c29ca89f36f"

}

HEAD request

Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.

HEAD request can be used to check if the gridMathAnalyst resource exists, or if the servicegridMathAnalyst sLoad resource can be accessed by clients. It can also determine if the gridMathAnalyst resource supports an output format <format> if performed on a URI with .<format> included.

See