The context
parameter provides additional options that affect spatial analysis requests. These parameters allow you to control the following:
extent
—The processing extent that determines which features are included in the analysis.out
—The spatial reference of the result.SR
You can define the processing extent using a different spatial reference than what you set for the output spatial reference. For example, you can define the extent
property using coordinates in the spatial reference wkid 4326
(GDC_WGS_1984), but set the spatial reference of the analysis result to be in wkid 3857
(WGS_1984 Web Mercator - Auxiliary Sphere).
Context syntax:
"context": {
"outSR": {"wkid": 3857}
"extent": {
"xmin": -122.68
"ymin": 45.5
"xmax": -122.45
"ymax": 45.6
"spatialReference": {"wkid": 4326}
}
Extent
Tasks that have the extent
property in the context
parameter will only process features that overlap the specified extent. The output features will have an extent that is the same as or larger than the extent
property, as demonstrated in the following example:
Extent syntax:
"extent": {
"xmin": <minimum x-coordinate>
"ymin": <minimum y-coordinate>
"xmax": <maximum x-coordinate>
"ymax": <maximum y-coordinate>
"spatialReference": {"wkid": <spatial reference well-known identifier>}
}
See the Output spatial reference section below for information about the spatial
property.
Extent example:
"extent": {
"xmin": -122.68,
"ymin": 45.53,
"xmax": -122.45,
"ymax": 45.6,
"spatialReference": {
"wkid": 4326
}
}
Using the extent
property is useful when you need to process only a portion of a larger dataset. Any feature that overlaps the rectangle defined by the extent
property will be processed during analysis. The rectangle is used only to select features, not clip them. The extent of the output dataset will typically be larger than the defined extent
property to account for features that overlap the extent
rectangle.
Output spatial reference
Tasks that have the out
property in the context
parameter will return features in the specified spatial reference. It is important to choose a spatial reference that's appropriate for your dataset and analysis type.
Spatial reference syntax:
"outSR": {"wkid" : <wkid>}
The wkid
is the well-known ID of a spatial reference. See Using spatial references for supported spatial references and their IDs.
Spatial reference example (GCS_WGS_1984)
"outSR": {"wkid": 4326}