Label Points

URL:
https://<root>/Utilities/Geometry/GeometryServer/labelPoints
Methods:
GET
Version Introduced:
9.3

Description

The labelPoints operation is performed on a geometry service resource. The labelPoints operation calculates an interior point for each polygon specified in the input array. These interior points can be used by clients for labeling the polygons. This operation calls simplify on the input polygons. You can provide arguments to the labelPoints operation as query parameters defined in the following parameters table.

Request parameters

ParameterDetails

polygons

Specifies the array of polygons whose label points are to be computed. The spatial reference of the polygons is specified by sr. The structure of each polygon in the array is the same as the structure of the JSON polygon objects returned by ArcGIS REST API.

Syntax

Use dark colors for code blocksCopy
1
[<polygon1>, <polygon2>, ..., <polygonN>]

Example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
[
  {
    "rings": [
      [[-117,34],[-116,34],[-117,33],[-117,34]],
      [[-115,44],[-114,43],[-115,43],[-115,44]]
    ]
  },
  {
    "rings": [
      [[32.49,17.83],[31.96,17.59],[30.87,17.01],[30.11,16.86],[32.49,17.83]]
    ]
  }
]

For a large set of geometries, you can specify a URL to the input geometries stored in a JSON structure in a file on a public server. The expected format of the file's contents will be the same as that expected if the polygons were directly embedded in the request.

URL-based syntax

Use dark colors for code blocksCopy
1
polygons={"url": "<URL to file>"}

URL-based example

Use dark colors for code blocksCopy
1
polygons={"url": "https://<myserver>/<mygeometries>/<afile.txt>"}

sr

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

f

The response format. The default response format is html.

Values: html | json | pjson

Example usage

The following is a sample request URL for labelPoints that computes a label point within the input polygon:

Use dark colors for code blocksCopy
1
https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/labelPoints?sr=4326&polygons=[{"rings":[[[-105,34],[-104,34],[-104,35],[-105,35],[-105,34]]]}]

JSON Response syntax

Use dark colors for code blocksCopy
1
2
3
{
  "labelPoints": [<point1>, <point2>, ..., <pointN>]
}

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "labelPoints": [
    {
      "x": -104.49999999999994,
      "y": 34.50000000000006
    }
  ]
}

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