GIS Tools

Language

Made withfor the GIS community

Attribute Filter Builder

Build SQL-like filters for feature attributes

Query & Filter

Drop files here or click to browse

Supported formats: GeoJSON

GeoJSON

Filter Tips

  • Use AND to match features meeting all conditions
  • Use OR to match features meeting any condition
  • Text comparisons are case-insensitive
  • Numeric operators convert values to numbers

What Is an Attribute Filter?

An attribute filter is a logical expression that selects features in a vector dataset based on the values of their non-spatial properties. In SQL terms, it is the WHERE clause for a spatial table. If you have a GeoJSON file of cities and you want to see only those with population greater than 100,000, you write an attribute filter like population > 100000 and the viewer hides every feature that does not match. This is the workhorse operation of GIS analysis: most map visualizations, statistical summaries, and exports start with a filter to narrow the data down to what matters.

Attribute filters operate on the attribute table that lives alongside every vector dataset. In a shapefile, that table is the DBF file. In a GeoJSON FeatureCollection, it is the properties object on each feature. In PostGIS, it is the columns of the spatial table. The filter expression evaluates each row independently and returns a boolean: keep or discard.

The gis.tools attribute filter builder is a visual query construction interface that lets you compose multi-clause expressions without writing SQL by hand. You pick a field from a dropdown, choose an operator (=, !=, <, >, <=, >=, IN, LIKE, IS NULL), enter a value, and chain clauses with AND/OR. The builder generates an expression that the viewer applies to the active layer in real time.

Unlike server-side query systems that round-trip every keystroke to a backend, the gis.tools filter runs entirely in your browser, so you get instant feedback as you build the expression. This matters when you are exploring a dataset and want to iterate on the predicate quickly.

How Attribute Filtering Works

Expression evaluation

When you submit a filter, the engine compiles your expression into a function that takes a single feature and returns true or false. It then walks the FeatureCollection and runs the function on each feature, marking matches as visible. For small datasets (a few thousand features), this is instantaneous. For larger datasets (hundreds of thousands), the engine uses a precomputed attribute index when available.

Operator semantics

Filter operators follow standard SQL semantics with a few JavaScript wrinkles:

  • Equality uses strict comparison (===), so "5" = 5 is false because string and number differ.
  • NULL handling treats null, undefined, and missing keys as equivalent. field IS NULL matches all three.
  • String matching with LIKE uses % as a wildcard for any sequence of characters and _ for a single character, mirroring SQL.
  • IN accepts a comma-separated list and matches any value in the list.
  • Numeric comparisons coerce string values to numbers when possible, falling back to NaN (which fails all comparisons) when coercion fails.

Combining clauses

Multi-clause filters use boolean logic with explicit operator precedence. AND binds tighter than OR, so A AND B OR C parses as (A AND B) OR C. The builder lets you nest groups with parentheses to override precedence.

Key Parameters and Options

Field type detection

The builder inspects the data and infers each field's type (string, number, boolean, date) from the first few hundred rows. Fields with mixed types are treated as strings to avoid silent coercion bugs.

Case sensitivity

String comparisons are case-sensitive by default, matching SQL standards. The builder offers a case-insensitive toggle that wraps both sides of the comparison in LOWER().

Date handling

Date fields parsed as ISO 8601 strings or Unix timestamps support range queries like date BETWEEN '2024-01-01' AND '2024-12-31'.

Practical Applications

Demographic analysis

A public health analyst working with census tract polygons filters down to tracts where median household income is below the federal poverty line and the percentage of residents over 65 exceeds 20 percent. The resulting subset becomes the basis for a vulnerability map that informs targeted outreach for vaccination programs.

Real estate market segmentation

A realty firm with a parcel dataset filters for properties zoned residential, between 1,500 and 3,000 square feet, built after 1980, and currently for sale. The filtered subset goes directly into a comparative market analysis report, saving hours of manual spreadsheet work.

Environmental compliance

An environmental consultant filters a permit dataset for facilities that have exceeded their discharge limits in the last quarter. The filtered features feed into a regulatory enforcement workflow, including notification letters and field inspection scheduling.

Network maintenance

A utility company filters its asset dataset for transformers older than 30 years located in flood zones (using a separate spatial join). The filtered subset becomes the inspection priority list for the next maintenance cycle.

Wildlife survey QA

A biologist filters a camera trap dataset for nighttime detections of a target species at sites within a protected area. The filtered subset goes into a population estimate model.

Logistics route planning

A delivery operations team filters a customer dataset for stops scheduled tomorrow with package weight under 20kg, generating a driver manifest that feeds into a routing optimizer.

Disaster damage assessment

After a hurricane, a relief coordinator filters a building footprint dataset for structures within a 100-year flood zone where the post-storm damage assessment field is marked "severe" or "destroyed."

Step-by-Step Workflow

  1. Load your dataset into the GeoJSON, KML, Shapefile & GIS File Viewer.
  2. Open the attribute filter builder for the active layer.
  3. Pick a field from the dropdown β€” the builder shows field type and a sample of values.
  4. Choose an operator (=, !=, <, >, IN, LIKE, IS NULL, BETWEEN).
  5. Enter a value or pick from the value autocomplete.
  6. Add more clauses with AND/OR.
  7. Apply the filter β€” the map updates instantly to show only matching features.
  8. Inspect the matched count in the layer panel.
  9. Export the matches with the Multi-Select & Export tool.

Worked Example

An urban planner has a GeoJSON of 5,200 building footprints in a midwestern city, each with attributes for year_built, stories, use_type, and parcel_value. They want to identify candidate properties for a historic preservation overlay: pre-1920 commercial buildings on parcels valued under $500,000 (to filter out high-value redevelopment targets). They build the filter:

year_built < 1920 AND use_type = 'commercial' AND parcel_value < 500000

The viewer instantly highlights 87 matching footprints across the downtown core. The planner exports them as a new GeoJSON via Multi-Select & Export, then loads the result into the GIS Buffer Tool to generate 100-meter buffers around each candidate for the next workshop with the preservation board.

Common Pitfalls and Gotchas

  • Type mismatch. Filtering population = '5000' will fail if the field is numeric. The builder usually flags this but mixed-type fields can sneak through.
  • Null vs empty string. A field with "" is not the same as a field with null. Use IS NULL for the latter and = '' for the former.
  • Case sensitivity. name = 'paris' will not match "Paris". Use the case-insensitive toggle or LOWER().
  • Date parsing failures. Dates stored as strings in non-ISO formats (DD/MM/YYYY) may not sort or compare correctly.
  • Floating-point comparisons. field = 0.1 + 0.2 will fail because of IEEE 754. Use ranges or rounded values.
  • Operator precedence. A OR B AND C is A OR (B AND C), not (A OR B) AND C. Use parentheses to be explicit.
  • Field name typos. Misspelling a field name silently returns an empty result rather than an error in some implementations.
  • Unicode normalization. Composed and decomposed Unicode forms (cafΓ© vs cafe\u0301) compare unequal.

Tips for Best Results

  • Use the Data Profiling Report before building filters to understand value distributions.
  • Test individual clauses one at a time before combining with AND/OR.
  • For large datasets, build an index on filtered fields to keep response times under 100ms.
  • Save common filter expressions as bookmarks via the Bookmarkable Map States tool for one-click recall.
  • Combine attribute filters with spatial filters from the Spatial Filter tool for compound queries.
  • Export the filtered subset as a new file before downstream processing β€” that gives you a stable input.
  • Use BETWEEN for inclusive numeric ranges; it is clearer than two AND-chained inequalities.

Comparison with SQL and Desktop GIS

QGIS calls this Select by Expression and uses a domain-specific language similar to SQL. ArcGIS uses Definition Queries with classic SQL syntax. PostGIS uses standard SQL WHERE clauses against the spatial table. The gis.tools filter builder is closer to QGIS in spirit: a friendly visual UI on top of a SQL-like expression engine, but everything runs in the browser without a backend.

The trade-off is that browser-side filtering does not scale to millions of rows. For very large datasets, pre-filter in PostGIS or DuckDB and load only the relevant subset into the viewer.

Performance Considerations

For datasets up to about 100,000 features, attribute filtering is effectively instantaneous (under 50ms). Above that, response times scale linearly. For 1 million features, simple filters take 100-300ms. Complex multi-clause filters or LIKE queries with leading wildcards can be slower.

Data Privacy and Browser-Based Processing

Filter expressions and the attribute values they reference never leave your browser. Even sensitive datasets like health records, salary data, or law enforcement databases can be filtered locally without transmitting anything to a server. This is a hard requirement for HIPAA-compliant workflows and many government data handling rules.

Related GIS Concepts

Definition query. ArcGIS terminology for an attribute filter applied at the layer level.

SQL WHERE clause. The database equivalent. PostGIS uses standard SQL.

Selection set. The collection of features that match a filter.

Field calculator. A related tool for computing new attribute values from expressions.

Frequently Asked Questions

Can I filter on multiple fields at once?

Yes. Chain clauses with AND or OR. The builder supports nested groups for complex logic.

Does filtering modify my data?

No. Filters are applied at render time. The underlying file is unchanged.

Can I save a filter and reuse it later?

Yes. Use the Bookmarkable Map States tool to save the filter expression as part of the map state.

How do I filter by date range?

Use BETWEEN with ISO 8601 date strings: date BETWEEN '2024-01-01' AND '2024-12-31'.

Can I filter null values?

Yes. Use field IS NULL or field IS NOT NULL.

Related Tools on gis.tools

100% client-side processing - your data stays private and never leaves your device