Skip to content

Commit f9e4060

Browse files
authored
Merge pull request #14 from boettiger-lab/fix/filter-syntax-docs
fix: replace legacy in filter syntax with match expressions throughout
2 parents 56ff9e7 + 0c9daaf commit f9e4060

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

app/map-tools.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ export function createMapTools(mapManager, catalog) {
7878
7979
IMPORTANT: After filtering, check 'featuresInView' in the result. If 0, the filter may be wrong.
8080
81-
Filter syntax:
82-
- Equality: ["==", "property", "value"]
83-
- Inequality: ["!=", "property", "value"]
84-
- Comparison: [">", "property", 100]
85-
- In list: ["in", "property", "val1", "val2", "val3"]
86-
- AND: ["all", ["==", "p1", "v1"], [">", "p2", 100]]
87-
- OR: ["any", ["==", "p", "v1"], ["==", "p", "v2"]]
81+
Filter syntax (use MapLibre expressions — NOT legacy filter arrays):
82+
- Equality: ["==", ["get", "property"], "value"]
83+
- Inequality: ["!=", ["get", "property"], "value"]
84+
- Comparison: [">", ["get", "property"], 100]
85+
- In list: ["match", ["get", "property"], ["val1", "val2", "val3"], true, false]
86+
- AND: ["all", ["==", ["get", "p1"], "v1"], [">", ["get", "p2"], 100]]
87+
- OR: ["any", ["==", ["get", "p"], "v1"], ["==", ["get", "p"], "v2"]]
88+
89+
IMPORTANT: Do NOT use the legacy ["in", "property", val1, val2] form — it is silently ignored in current MapLibre. Always use ["match", ["get", "property"], [...values], true, false] for list membership.
8890
8991
Vector layers: ${vectorLayerIds().join(', ')}
9092
${getPropertyDocs()}`,

example-ghpages/system-prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ WITH county_carbon AS (
5252
SELECT * FROM county_carbon
5353
```
5454

55-
Then visualize: `show_layer("overturemaps/overturemaps-admins")` and `set_filter("overturemaps/overturemaps-admins", ["in", "NAMELSAD", "County1", "County2", …])`.
55+
Then visualize: `show_layer("overturemaps/overturemaps-admins")` and `set_filter("overturemaps/overturemaps-admins", ["match", ["get", "NAMELSAD"], ["County1", "County2"], true, false])`.
5656

5757
## Available datasets
5858

example-k8s/system-prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ WITH county_carbon AS (
5252
SELECT * FROM county_carbon
5353
```
5454

55-
Then visualize: `show_layer("overturemaps/overturemaps-admins")` and `set_filter("overturemaps/overturemaps-admins", ["in", "NAMELSAD", "County1", "County2", …])`.
55+
Then visualize: `show_layer("overturemaps/overturemaps-admins")` and `set_filter("overturemaps/overturemaps-admins", ["match", ["get", "NAMELSAD"], ["County1", "County2"], true, false])`.
5656

5757
## Available datasets
5858

0 commit comments

Comments
 (0)