Project

Description

The project operation is performed on a geometry service resource. This operation projects an array of input geometries from the input spatial reference to the output spatial reference.

At 10.1 and later, this operation calls simplify on the input geometries.

You can provide arguments to the project operation as query parameters defined in the following parameters table:

Request parameters

Parameter

Details

f

Description:  (Optional) The response format. The default response format is html.
Values:   html | json

geometries

Description: The array of geometries to be projected. The structure of each geometry in the array is the same as the structure of the JSON geometry objects returned by the ArcGIS REST API.

JSON structures:

Syntax:

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

NoteNote:

Support for the esriGeometryEnvelope geometry type was added at 9.3 SP1.

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

Example:

{
  "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]]
      ]
    }
  ]
}

Simple Syntax for point geometries: 
When using points, in addition to the JSON structures, you can specify the geometries with a simpler comma-separated syntax. 
Syntax: geometries=x1, y1, x2, y2, ..., xn, yn
Example: geometries=-104.53, 34.74, -63.53, 10.23

URL based:  
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 exactly the same as that expected if the geometries were directly embedded in the request. 
Syntax: geometries={ "url" : "<URL to file>" }
Example: geometries={ "url" : "http://myserver/mygeometries/afile.txt" }

inSR

Description: The well-known ID of the spatial reference or a spatial reference JSON object for the input geometries. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

outSR

Description: The well-known ID of the spatial reference or a spatial reference JSON object for the returned geometries. For a list of valid WKID values, see Projected coordinate systems and Geographic coordinate systems.

transformation

NoteNote:
This option was added at 10.1.

Description: (Optional) The well-known ID or a JSON object specifying the datum transformation to be applied to the projected geometries. For a list of valid datum transformation ID values, see Datum transformations.

If transformation is not specified, a search is made through a set of default geographic transformations. Currently, the following default transformations are used when applicable:

  • esriSRGeoTransformation_NAD_1927_TO_NAD_1983_NADCON, forward and reverse, WKID=1241
  • esriSRGeoTransformation_NAD1983_To_WGS1984_1, forward and reverse, WKID=1188
  • esriSRGeoTransformation_NAD1927_To_WGS1984_4, forward and reverse, WKID=1173

transformFoward

NoteNote:
This option was added at 10.1.

Description: (Optional) A Boolean value indicating whether or not to transform forward. The forward or reverse direction of transformation is implied in the name of the transformation. If transformation is specified, a value for the transformForward parameter must also be specified. The default value is false.

Values: true | false

Example usage

This example projects two polygons from WGS 84 (4326) to Web Mercator (3857).

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR=4326&outSR=3857&geometries={"geometryType":"esriGeometryPolygon","geometries":[{"rings":[[[-117,34],[-116,34],[-117,33],[-117,34]],[[-115,44],[-114,43],[-115,43],[-115,44]]]},{"rings":[[[32,17],[31,17],[30,17],[30,16],[32,17]]]}]}

JSON response syntax

{
  "geometries" : [ <geometry1>, <geometry1>, ..., <geometryN> ]
}

JSON response example

{
 "geometries": [
  {
   "rings": [
    [
     [
      -12913060.932019727,
      4028802.0261344141
     ],
     [
      -13024380.422813002,
      3895303.9633939015
     ],
     [
      -13024380.422813002,
      4028802.0261344141
     ],
     [
      -12913060.932019727,
      4028802.0261344141
     ]
    ],
    [
     [
      -12690421.95043318,
      5311971.8469454823
     ],
     [
      -12801741.441226454,
      5311971.8469454823
     ],
     [
      -12801741.441226454,
      5465442.1833227612
     ],
     [
      -12690421.95043318,
      5311971.8469454823
     ]
    ]
   ]
  },
  {
   "rings": [
    [
     [
      3562223.7053847606,
      1920825.040377473
     ],
     [
      3339584.7237982131,
      1804722.7662572993
     ],
     [
      3339584.7237982131,
      1920825.040377473
     ],
     [
      3450904.2145914868,
      1920825.040377473
     ],
     [
      3562223.7053847606,
      1920825.040377473
     ]
    ]
   ]
  }
 ]
}