The FindExistingLocations task selects features in the input layer that meet a specified query. A query is composed of one or more expressions. There are two types of expressions: attribute and spatial. An example of an attribute expression is a parcel must be vacant, which is an attribute of the Parcels layer (where STATUS = 'VACANT'). An example of a spatial expression is the parcel must also be within a certain distance of a river (Parcels within a distance of 0.75 Miles from Rivers).
The layer value is the index of the layer in the inputLayers parameter.
The where clause must be enclosed by double quotes.
When working with text fields, values must be in single quotes, for example, ('VACANT').
Date fields support all queries except LIKE. Dates are strings in YYYY:MM:DD hh:mm:ss format. The following is an example using the date field ObsDate:
"where": "ObsDate >= '1998-04-30 13:30:00' "
Operator
Description
=
Equal
>
Greater than
<
Less than
>=
Greater than or equal to
<=
Less than or equal to
<>
Not equal
LIKE '%<string>'
A percent symbol (%) signifies a wildcard, meaning that anything is acceptable in its
place—one character, a hundred characters, or no character.
The following expression would select Mississippi and Missouri among USA
state names:
STATE_NAME LIKE 'Miss%'
BETWEEN <value1> AND <value2>
Selects a record if it has a value greater than or equal to <value1> and less than or equal to <value2>. For example, the following expression selects all records with an HHSIZE value greater than or equal to 3 and less than or equal to 10:
HHSIZE BETWEEN 3 AND 10
The above is equivalent to the following:
HHSIZE >= 3 AND HHSIZE <= 10
This operator applies to numeric or date fields. The following is an example of a date query on the ObsDate field:
ObsDate BETWEEN '1998-04-30 00:00:00' AND
'1998-04-30 23:59:59'
Time is optional.
NOT BETWEEN <value1> AND <value2>
Selects a record if it has a value outside
the range between <value1> and <value2>.
For example, the following expression selects all records with an HHSIZE value less than 5 and greater than 7:
The layer value is the index of the layer in the inputLayers parameter. The result of the expression is features in this layer.
The spatialRel value is the spatial relationship. The nine spatial relationships are described in the following table:
spatialRel
Description
intersects
notIntersects
A feature in layer passes the intersect test if it overlaps any part of a feature in selectingLayer, including touches (where features share a common point).
intersects—If a feature in layer intersects a feature in selectingLayer, the feature in layer is included in the output.
notIntersects—If a feature in layer intersects a feature in selectingLayer, the feature in layer is excluded from the output.
withinDistance
notWithinDistance
The within a distance relationship uses the straight-line distance between features in layer to those in selectingLayer.
withinDistance—A feature in layer is selected (included in the output) if any part is within the specified distance of a feature in selectingLayer. For example, parcels within 100 meters of a river will be included in the output.
notWithinDistance—A feature in layer is excluded (not included in the output) if it is within a distance of a feature in selectingLayer. For example, parcels within 100 meters of a river will not be included in the output. You can think of this relationship as is farther away than.
Nota:
Distances are calculated between the closest parts of features. For example, if the criteria is that parcels are to be within 0.75 miles of the Los Angeles River, parcels are selected if any part of the parcel is within 0.75 miles. If the criteria is that the entire parcel must be within 0.75 miles, use the Create Buffers tool with a distance of 0.75 miles around the Los Angeles River to create a new layer. Then create an expression where parcels are completelyWithin the buffer layer.
contains
notContains
A feature in layer passes this test if it completely surrounds a feature in selectingLayer. No portion of the contained feature can be outside the containing feature; however, the contained feature can touch the containing feature (that is, share a common point along its boundary).
contains—If a feature in layer contains a feature in selectingLayer, the feature in layer is included in the output.
notContains—If a feature in layer contains a feature in selectingLayer, the feature in the first layer is excluded from the output.
Nota:
You can use the contains relationship with points and lines. For example, you have a layer of street centerlines (lines) and a layer of manhole covers (points), and you want to find streets that contain a manhole cover. You can use contains to find streets that contain manhole covers, but, for a line to contain a point, the point must be exactly on the line (that is, in GIS terms, they are snapped to each other). If there is any doubt about this, use the withinDistance relationship with a suitable distance value.
within
notWithin
A feature in layer passes this test if it is completely surrounded by a feature in selectingLayer. The entire feature in layer must be within the containing feature; however, the two features can touch (that is, share a common point along its boundary).
within—If a feature in layer is completely within a feature in selectingLayer, the feature in layer is included in the output.
notWithin—If a feature in layer is completely within a feature in selectingLayer, the feature in layer is excluded from the output.
Nota:
You can use the within relationship for points and lines, just as you can with the contains relationship. For example, the first layer contains points representing manhole covers and you want to find the manholes that are on street centerlines (as opposed to parking lots or other nonstreet features). You can use within to find manhole points within street centerlines, but. for a point to contain a line, the point must be exactly on the line (that is, in GIS terms, they are snapped to each other). If there is any doubt about this, use the withinDistance relationship with a suitable distance value.
nearest
A feature in the first layer passes this test if it is nearest to a feature in the second layer.
nearest—If a feature in the first layer is nearest to a feature in the second layer, the feature in the first layer is included in the output.
The distance value is the distance to use for the withinDistance and notWithinDistance spatial relationship.
The units value is the units to use for the distance parameter. Values: Meters | Kilometers | Feet | Yards | Miles
An expression can be a list, which denotes a group. The first operator in the group indicates how the group expression is added to the previous expression. Grouping expressions is only necessary when you need to create two or more distinct
sets of features from the same layer. One way to think of grouping is that without grouping, you would have to run the FindExistingLocations task multiple times and merge the results.
The following is an example where grouping is needed:
You have a layer representing places that contain toxic chemicals. Each feature has an attribute, CHEMICAL, containing the name of the toxic chemical known to exist at the site.
You want to find toxic sites containing Mercury or Selenium that are near a river (layer 0).
You also want to find toxic sites containing Benzene or Lead that are near a park (layer 1).
If provided, the task will create a feature service of the results. You define the name of the service. If an outputName value is not provided, the task will return a feature collection.
In ArcGIS Online or ArcGIS Enterprise10.9.1 and later, you can overwrite an existing feature service by providing the itemId value of the existing feature service and setting the overwrite property to True. Including the serviceProperties parameter is optional. As described in the Feature output topic, you must either be the owner of the feature service or have administrative privileges to perform the overwrite.
Syntax:
{
"itemProperties": {
"itemId": "<itemID of the existing feature service>",
"overwrite": True
}
}
or
{
"serviceProperties": {
"name": "<existing service name>"
},
"itemProperties": {
"itemId": "<itemID of the existing feature service>",
"overwrite": True
}
}
context
The Context parameter contains the following additional settings that affect task operation:
Extent (extent)—A bounding box that defines the analysis area. Only input features that intersect the bounding box will be analyzed.
Output spatial reference (outSR)—The output features will be projected into the output spatial reference.
The response format. The default response format is html.
Values: html | json
clipFeatures
When only a portion of a feature meets the criteria, this parameter specifies whether the result includes the entire feature or only the portions of the feature that meet all criteria:
True—Only the portions of the feature that meet all criteria will be returned. Specifying this option, is equivalent to running the DeriveNewLocations task.
False—The entire feature will be returned provided at least a portion of the feature meets all criteria. This is the default.
This parameter is available in ArcGIS Online or ArcGIS Enterprise11.2 and later.
"clipFeatures":false
Response
When you submit a request, the service assigns a unique job ID for
the transaction.
After the initial
request is submitted, you can use the
jobId value to periodically check the status of the job and messages as described in the Checking job status topic.
Once the job has successfully completed, use
the jobId value to retrieve the results. To track the status, you can make a request of the following form:
The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request.
If an outputName value was provided, value contains the URL to the feature service layer.