The Find Existing Locations task selects features in the input layer that meet a query you specify. A query is made up of one or more expressions. There are two types of expressions: attribute and spatial. An example of an attribute expression is that a parcel must be vacant, which is an attribute of the Parcels layer (where STATUS = 'VACANT'). An example of a spatial expression is that the parcel must also be within a certain distance of a river (Parcels within a distance of 0.75 Miles from Rivers).
layer is the index of the layer in the inputLayers parameter.
The where clause must be surrounded by double quotes.
When dealing with text fields, values must be single-quoted ('VACANT').
Date fields support all queries except LIKE. Dates are strings in YYYY:MM:DD hh:mm:ss format. Here's an example using the date field ObsDate:
"where": "ObsDate >= '1998-04-30 13:30:00' "
Greater than or equal to
Less than or equal to
A percent symbol (%) signifies a wildcard, meaning that anything is acceptable in its
place—one character, a hundred characters, or no character.
This expression would select Mississippi and Missouri among USA
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, this 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:
HHSIZE >= 3 AND HHSIZE <= 10
This operator applies to numeric or date fields. Here is an example of a date query on the field ObsDate:
ObsDate BETWEEN '1998-04-30 00:00:00' AND
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, this expression selects all records whose HHSIZE value is less than 5 and greater than 7:
layer is the index of the layer in the inputLayers parameter. The result of the expression is features in this layer.
spatialRel is the spatial relationship. There are eight spatial relationships.
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.
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".
Distances are calculated between the closest parts of features. For example, if 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, you would use the Create Buffers tool with a distance of 0.75 miles around the Los Angeles River to create a new layer. You would then create an expression where parcels within the buffer layer.
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 is allowed to 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.
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 could use contains to find streets that contain manhole covers, but in order 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.
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 are allowed to 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.
You can use the within relationship for points and lines, just as you can with the contains relationship. For example, your 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 non-street features). You could use within to find manhole points within street centerlines, but in order 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.
distance is the distance to use for the withinDistance and notWithinDistance spatial relationship.
units is the units for distance. Values: Meters | Kilometers | Feet | Yards | Miles
An expression may 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 execute Find Existing Locations multiple times and merge the results.
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).
After the initial
request is submitted you can use the
jobId to periodically check the status of the job and messages as described in the topic Checking job status.
Once the job has successfully completed, you use
the jobId to retrieve the results. To track the status, you can make a request of the following form: