Query an ArcGIS layer's features
query_layerFilter ArcGIS FeatureServer or MapServer layers by attribute and/or spatial criteria, returning matching feature attributes and optional geometry as JSON. Use for targeted queries on GIS datasets.
Instructions
Run an attribute and/or spatial query against an ArcGIS FeatureServer/MapServer layer (e.g. OCC well points, tank sites) and return matching feature attributes (and optionally geometry) as JSON. Use get_layer_metadata first to see available fields.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| where | No | SQL-style attribute filter, e.g. "COUNTY = 'OKLAHOMA'" or "STATUS = 'AC'". Defaults to 1=1 (all rows). | |
| geometry | No | Optional spatial filter geometry, e.g. 'xmin,ymin,xmax,ymax' envelope in WGS84 lon/lat. | |
| layerUrl | Yes | ArcGIS REST layer URL, e.g. https://gis.occ.ok.gov/server/rest/services/Hosted/RBDMS_WELLS/FeatureServer/220 | |
| outFields | No | Comma-separated field names to return, or '*' for all (default). | |
| spatialRel | No | Spatial relationship, e.g. esriSpatialRelIntersects (default). | |
| geometryType | No | Geometry type for the 'geometry' param, e.g. esriGeometryEnvelope (default) or esriGeometryPoint. | |
| orderByFields | No | Comma-separated field(s) to sort by, e.g. 'API_NUMBER ASC'. | |
| returnGeometry | No | Whether to include geometry (lat/lon) in results (default false). | |
| resultRecordCount | No | Max number of records to return (default 50). |