Closed lccspatial closed 8 years ago
Here is an example:
import arcrest
if __name__ == "__main__":
fl_url = "https://site.com/arcgis/rest/services/reference/adminboundaries/FeatureServer/0"
token_url = "https://site.com/arcgis/admin/generateToken"
org_url="https://sitecom/arcgis"
username = "admin"
pw = "some password"
where = "ISO_CC = 'US'"
sh = arcrest.AGSTokenSecurityHandler(username=username,
password=pw,
org_url=org_url,
token_url=token_url)
fl = arcrest.ags.FeatureLayer(url=fl_url,securityHandler=sh)
fs = fl.query(where=where)
print ("Found %s features with the where clause: %s" % (len(fs), where) )
if len(fs.features) > 0:
feature = fs.features[0]
geom = feature.geometry
geomFilter = arcrest.filters.GeometryFilter(geomObject=geom)
result = fl.query(where=where, geomtryFilter=geomFilter, as_json=True) # set as_json=False for the featureset object
print ("Found %s features with the where clause: %s and geometry filter" % (len(result['features']), where) )```
ArcRest or ArcRestHelper
Hi was recommended to post my question here also https://geonet.esri.com/message/612026?et=watches.email.thread#comment-612026
Basically I'm just after sample code on the most efficient way of using a geometry obtained from a feature layer query operation and plugging that in to a subsequent feature layer query as a geometry filter.