Skip to main content
Skip to main content

Your First Filter

This tutorial walks you through creating your first filter with FilterMate, from start to finish.

Scenario​

Goal: Find all buildings within 200 meters of a main road.

Data Required:

  • A buildings layer (polygons)
  • A roads layer (lines)

Step-by-Step Tutorial​

1. Load Your Data​

First, load both layers into QGIS:

  1. Open QGIS
  2. Load the buildings layer (the layer we'll filter)
  3. Load the roads layer (the reference layer)
Sample Data

If you don't have sample data, you can use OpenStreetMap data:

  • Download from Geofabrik
  • Or use QGIS QuickOSM plugin to fetch data

2. Open FilterMate​

  1. Click the FilterMate icon in the toolbar
  2. Or go to Plugins β†’ FilterMate
  3. The dockable panel appears on the right side

FilterMate panel ready for your first geometric filter

3. Select the Target Layer​

  1. In the Layer Selection dropdown at the top
  2. Select buildings (the layer we want to filter)

FilterMate will analyze the layer and display:

  • Backend being used (PostgreSQL, Spatialite, or OGR)
  • Feature count
  • Available fields

4. Set Up Geometric Filter​

Now we'll create a spatial filter to find buildings near roads:

  1. Go to the Geometric Filter tab

    • Click the Geometric Filter tab in the panel
  2. Select Reference Layer

    • Choose roads from the reference layer dropdown
  3. Choose Spatial Predicate

    • Select "within distance" or "intersects" (if using buffer)
  4. Set Buffer Distance

    • Enter 200 in the buffer distance field
    • Units: meters (or your layer's CRS units)
CRS Reprojection

FilterMate automatically reprojects layers if they have different CRS. No manual reprojection needed!

5. Apply the Filter​

  1. Click Apply Filter button
  2. FilterMate will:
    • Create a temporary filtered view
    • Highlight matching features on the map
    • Update the feature count in the panel

What happens behind the scenes:

-- For large datasets (β‰₯10k features):
-- Creates a materialized view with spatial index
CREATE MATERIALIZED VIEW temp_filter AS
SELECT b.*
FROM buildings b
JOIN roads r ON ST_DWithin(b.geom, r.geom, 200);

CREATE INDEX idx_temp_geom ON temp_filter USING GIST(geom);

-- For small datasets (<10k features):
-- Uses direct subset string (no materialized view)

⚑ Ultra-fast (sub-second on 100k+ features with MV)

6. Review Results​

After filtering:

  • Map Canvas: Filtered buildings are highlighted
  • Panel: Shows count of filtered features
  • Attribute Table: Open to see filtered features
Zoom to Results

Right-click the layer β†’ Zoom to Layer to see all filtered features

7. Refine the Filter (Optional)​

Want to add attribute criteria? Combine with an attribute filter:

  1. Go to Attribute Filter tab
  2. Add an expression like:
    "building_type" = 'residential'
  3. Click Apply Filter

Now you have buildings that are:

  • βœ… Within 200m of roads
  • βœ… AND are residential buildings

8. Export Results (Optional)​

To save the filtered buildings:

  1. Go to Export tab
  2. Choose output format:
    • GeoPackage (recommended for modern workflows)
    • Shapefile (for compatibility)
    • PostGIS (to save to database)
  3. Configure options:
    • Output CRS (default: same as source)
    • Output location
  4. Click Export

What You Learned​

βœ… How to open FilterMate and select a layer
βœ… How to create a geometric filter with buffer
βœ… Understanding backend selection (automatic)
βœ… How to combine attribute and geometric filters
βœ… How to export filtered results

Next Steps​

Now that you've created your first filter, explore more:

Common Issues​

No features returned?​

Check:

  • βœ… Buffer distance is appropriate for your CRS (meters vs. degrees)
  • βœ… Layers have overlapping extents
  • βœ… Reference layer has features

Filter is slow?​

For large datasets:

Wrong CRS?​

FilterMate reprojects automatically, but you can check:

  1. Layer properties β†’ CRS tab
  2. Ensure both layers have valid CRS defined
  3. FilterMate handles the rest!