within_distance
Finds layer features within a specified metre distance of a coordinate or another layer's features, returning nearest matches first with geodesic distances.
Instructions
Features of layer within distance_m METRES of a reference: a lon/lat point OR feature(s) from another layer. Distances are geodesic/metric regardless of the layer's SRID. Results include distance_m, nearest first. If the user did not say what to measure from, or the reference matches several features, ASK the user.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lat | No | Latitude (WGS84, north-south, -90..90). | |
| lon | No | Longitude (WGS84, east-west, -180..180). | |
| layer | Yes | ||
| limit | No | Max rows to return (default 100; server-side cap applies). | |
| columns | No | Attribute columns to return (default: all non-geometry). | |
| filters | No | Attribute filters on the layer, combined with AND. | |
| geometry | No | 'auto' (default): full geometry if small, else representative points; 'full'; 'centroid'; 'none' (attributes only). The complete geometry is always kept server-side under result_id for render_map. | auto |
| distance_m | Yes | Radius in metres. | |
| reference_layer | No | Measure from the geometry of feature(s) in this layer instead of a lon/lat point. | |
| use_all_matches | No | If the reference matches several features, use all of them (union) instead of asking. | |
| reference_filters | No | Filters that pick the reference feature(s) in reference_layer (e.g. name = 'X'). |