Generalize

URL:
https://<root>/Utilities/Geometry/GeometryServer/generalize
Methods:
GET
Version Introduced:
10.0

Description

The generalize operation is performed on a geometry service resource. The generalize operation simplifies the input geometries using the Douglas-Peucker algorithm with a specified maximum deviation distance. The output geometries will contain a subset of the original input vertices. You can provide arguments to the generalize operation as query parameters defined in the following parameters table.

Request parameters

ParameterDetails

geometries

Specifies the array of geometries to be generalized. The spatial reference of the geometries is specified by sr. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by ArcGIS REST API.

The geometries property is an array of input geometries. All geometries in this array should be of the type defined by the geometryType property.

Syntax

1
2
3
4
{
  "geometryType": "<esriGeometryPolyline | esriGeometryPolygon>">,
  "geometries": [<geometry1>, <geometry1>, ..., <geometryN>]
}

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "geometryType" : "esriGeometryPolyline",
    "geometries" :
  [
    {
      "paths" :
      [
        [[-117,34],[-116,34],[-117,33]],
        [[-115,44],[-114,43],[-115,43]]
      ]
    },
    {
      "paths" :
      [
        [[32,17],[31,17],[30,17],[30,16]]
      ]
    }
  ]
}

sr

Specifies the well-known ID (WKID) or a spatial reference JSON object for the input geometries. For a list of valid WKID values, see Using spatial references.

maxDeviation

Sets the maximum allowable offset, which determines the degree of simplification. This value limits the distance the output geometry can differ from the input geometry.

deviationUnit

(Optional)

Specifies a unit for maximum deviation. If a unit is not specified, the units are derived from sr. For a list of valid units, see esriSRUnitType Constants and esriSRUnit2Type Constants.

f

The response format. The default response format is html.

Values: html | json | pjson

Example usage

The following is a decoded sample request URL (the actual URL must be encoded) for generalize that demonstrates how a polygon is generalized:

https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/generalize?sr=4326&geometries={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[-87,40],[-87.1,40.3],[-87.2,40.5],[-87.2,40.6],[-86.8,40.6],[-86.7,40.6],[-86.7,40.4],[-86.7,40.2],[-87,40]]]}]}&maxDeviation=20&deviationUnit=9035

JSON Response syntax

1
2
3
4
{
  "geometryType" : "<esriGeometryPoint | esriGeometryMultipoint | esriGeometryPolyline | esriGeometryPolygon>"
  "geometries" : [ <geometry1>, <geometry1>, ..., <geometryN> ]
}

JSON Response example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
 "geometryType": "esriGeometryPolygon",
 "geometries": [{"rings": [[
  [
   -87,
   40
  ],
  [
   -87.2,
   40.6
  ],
  [
   -86.7,
   40.6
  ],
  [
   -87,
   40
  ]
 ]]}]
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close