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

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 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 (WKID) 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 WKID 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 WKID or a JSON object specifying the geographic transformation (also known as datum transformation) to be applied to the projected geometries. Note that a transformation is needed only if the output spatial reference contains a different geographic coordinate system than the input spatial reference or if projecting between different vertical systems. If a vertical transformation is used, it may require data files that are not installed by default. A separate setup is included to install ArcGIS Coordinate Systems Data, which contains the data files required for the GEOCON transformation method and vertical transformation files for the United States (VERTCON and GEOID12B) and the world (EGM2008). Additionally, it contains updated NTv2 files for the UK and Switzerland plus a new grid file for the Crossrail project in the greater London area.

For a list of valid geographic transformation ID values and well-known text strings, see Geographic transformations.

The easiest way to specify a geographic transformation is by using its WKID; however, a transformation can also be specified as a JSON object. This form is especially useful if creating a custom transformation or a composite transformation.

A single transformation can be specified in JSON format by using the field name wkid, name, or wkt.

The following examples all specify the same geographic transformation:

WKID

15851

WKID in JSON format:

{"wkid" : 15851 }

Well-known text (WKT):

{"wkt" : "GEOGTRAN[\"NAD_1927_To_WGS_1984_79_CONUS\",GEOGCS[\"GCS_North_American_1927\",DATUM[\"D_North_American_1927\",SPHEROID[\"Clarke_1866\",6378206.4,294.9786982]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],METHOD[\"NADCON\"],PARAMETER[\"Dataset_conus\",0.0]]"}

If a custom transformation is specified using a JSON object, it should use the well-known text string representation. See Example 2 below.

A composite transformation chains two geographic transformations together. For example, suppose you want to project your data from NAD83 to WGS84. You can first apply a transformation from NAD83 to NAD27, and then apply a transformation from NAD27 to WGS84. Again, when specifying the individual transformation, you can use its WKID, name, or WKT.

The following example of a composite transformation from NAD83 to WGS84 uses the WKID field to specify the individual transformation. The JSON object begins with the field name geoTransforms and has an array of two transformations. You should also specify whether to transform forward or backward.

{
  "geoTransforms": [
    {
      "wkid": "1241",
      "transformForward": false
    },
    {
      "wkid": "15851",
      "transformForward": true
    }
  ]
}

If using a vertical transformation, it must be specified as a composite transformation even if it contains only one transformation.

The following example is a composite transformation with one vertical transformation. The JSON object begins with the field name hvTransforms and has an array of one transformation.

{"hvTransforms": [{"wkid": 4453}]}

To find the best transformation based on your data and the input and output spatial references, use FindTransformations.

NoteNote:
Specifying only the transformation name is invalid. Using an invalid JSON object is equivalent to leaving the transformation parameter blank. In the next release, using an invalid JSON object will result in an error.

Invalid transformation JSON object:

{"name" : "NAD_1927_To_WGS_1984_79_CONUS"}

If transformation is not specified, a search is made through the gtdefaults.json file in the pedata folder for an applicable transformation. If Vertical is set to true, a search is made through the hvtdefaults.json file in the pedata folder for an applicable horizontal or vertical transformation. The pedata folder, the gtdefaults.json, and the hvtdefaults.json files are installed automatically in your server directory when you install ArcGIS Server. If an appropriate transformation is not found in the gtdefaults.json or the hvtdefaults.json file, or if the appropriate file does not exist, the server chooses the best transformation to use based on the input data and spatial references.

transformForward

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 the 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

vertical
NoteNote:
This option was added at 10.5.

Description: (Optional) Specifies whether to project vertical coordinates. The default value is false. If vertical is set to true, both inSR and outSR must have a vertical coordinate system.

Values: true | false

Example usage

Example 1

This example projects two polygons from WGS84 (4326) to Web Mercator (3857). A geographic transformation is not specified since the Web Mercator projection has as its underlying geographic coordinate system WGS84, which is the input coordinate system.

https://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
     ]
    ]
   ]
  }
 ]
}

Example 3

This example projects a point that has z-values from WGS84 (4236) with vertical coordinate system EGM2008 (3855) to NAD83_PA11 (6322) with vertical coordinate system NAD83_PA11 (115762). The output vertical coordinate system is different from the input vertical coordinate system, so a horizontal or vertical transformation is specified. The horizontal or vertical transformation was found by using FindTransformations and copying the result.

https://<your server>/arcgis/rest/services/Utilities/Geometry/GeometryServer/project?inSR={"wkid": 4326, "vcsWkid": 3855}&outSR={"wkid": 6322, "vcsWkid": 115762}&geometries={"geometryType": "esriGeometryPoint", "geometries": [{"x": 165, "y": -20, "z": -1},{"x": 174, "y": -11, "z": 20}]}&transformation={"hvTransforms": [{"wkid": 110019, "latestWkid": 110019, "transformForward": False, "name": "WGS_1984_To_WGS_1984_EGM2008_2.5x2.5_Height"}, {"wkid": 108365, "latestWkid": 108365, "transformForward": True, "name": "WGS_1984_(ITRF08)_To_NAD_1983_PA11"}]}&transformForward=true&vertical=true&f=html

The output looks like the following:

{"geometries": [
 {
  "x": 165.00001795095102,
  "y": -20.00001475789611,
  "z": 57.0102771227982
 },
 {
  "x": 174.00001812880745,
  "y": -11.000011492727607,
  "z": 65.60194478425002
 }
]}