Skip to content

Advanced Filtering

Filter layer data to show only features that meet specific criteria.

Overview

Built on ArcGIS FeatureLayerView filtering with real-time SQL validation and statistics support.

Technical Foundation:

  • Filter Engine: ArcGIS client-side filtering for immediate visual feedback
  • Layer Support: FeatureLayer, MapImageLayer (including sublayers), GroupLayer
  • SQL Validation: Real-time syntax checking with error/warning/info feedback
  • Statistics: Calculates min, max, avg, sum, count for numeric fields on filtered results
  • Export: Filtered features exportable in Shapefile, GeoJSON, KML, GPX with projection transformation
  • Performance: Layer cache optimization for faster repeated queries

Filter Modes:

  • Quick Filter (Panel Tab 0): Simple single-field filtering with operation selector
  • SQL Mode (Dialog Tab 1): Direct SQL WHERE clause with syntax validation for complex queries
  • Statistics Tool (Dialog Tab 2): Calculate statistics on numeric fields from filtered results

[insert image later]


Quick Filter Mode

Purpose

Fast, simple filtering for single-condition queries.

[insert image later]

Best For:

  • Finding features by single attribute
  • Quick data exploration
  • Simple queries

How to Use Quick Filter

Location: Toolbar → Filter icon

Steps:

  1. Select Layer: Choose layer to filter

    • Only visible layers appear in list
  2. Select Field: Choose attribute field

    • All field types supported
  3. Select Operation: Choose comparison operator

    • = Equal to
    • != Not equal to
    • Greater than

    • < Less than
    • = Greater than or equal

    • <= Less than or equal
    • LIKE Pattern matching (use % wildcards: 'SMITH%')
    • NOT LIKE Negated pattern matching
    • IN Match list of values (e.g., IN ('VAL1', 'VAL2'))
    • NOT IN Exclude list of values
    • IS NULL Check for null values
    • IS NOT NULL Check for non-null values
    • BETWEEN Range check (e.g., BETWEEN 1000 AND 5000)
  4. Enter Value: Type filter value

    • Text values (automatically quoted in SQL generation)
    • Numeric values (integers, decimals)
    • Date values (format depends on layer source)
    • Case-insensitive toggle: Converts SQL to UPPER(field) = UPPER('value') pattern
  5. Apply Filter: Click "Apply" button

    • Applies SQL WHERE clause to layer
    • Layer updates immediately to show only matching features
    • Non-matching features hidden (not deleted)
    • Feature count displayed in UI
    • Map extent unchanged (filtered features remain in current view)

[insert image later]


Quick Filter Examples

# Show only residential zoning
Layer: Zoning
Field: ZONE_CODE
Operation: =
Value: RES

# Find high-value properties
Layer: Property Parcels
Field: LAND_VALUE
Operation: >
Value: 500000

# Properties in specific suburb
Layer: Parcels
Field: SUBURB
Operation: =
Value: HOBART

SQL Mode

Purpose

Write raw SQL WHERE clauses for complex queries.

[insert image later]

Best For:

  • Experienced GIS users familiar with SQL
  • Complex queries with multiple conditions
  • Queries requiring functions

How to Use SQL Mode

Access: Filter Panel → "SQL" tab

Interface:

  • SQL Editor: Multi-line text input
  • Syntax Validation: Real-time error checking
  • Test Query: Validate before applying

[insert image later]


SQL Syntax Rules

Basic Structure:

sql
FIELD_NAME OPERATOR VALUE

Important Notes:

  • Do NOT include "WHERE" keyword (auto-added)
  • Text values in single quotes: 'VALUE'
  • Field names can use brackets: [FIELD NAME]
  • Case-sensitive by default (toggle for case-insensitive)

SQL Examples

Simple Queries:

sql
-- Equal
ZONE_CODE = 'RES'

-- Greater than
LAND_VALUE > 500000

-- IS NULL
OWNER IS NULL

-- IN list
SUBURB IN ('HOBART', 'BATTERY POINT')

Complex Queries:

sql
-- Multiple conditions with AND
ZONE_CODE = 'RES' AND LAND_VALUE > 500000 AND AREA_HA > 0.4

-- OR logic with parentheses
(ZONE_CODE = 'RES' OR ZONE_CODE = 'MIX') AND LAND_VALUE > 300000

-- BETWEEN
LAND_VALUE BETWEEN 300000 AND 800000

-- Complex nested logic
(ZONE_CODE IN ('RES', 'MIX') AND AREA_HA > 0.4)
AND (SLOPE_DEG < 15 OR BUILDABLE_AREA_HA > 0.3)
AND HERITAGE = 'NO'

Advanced Functions:

sql
-- Case-insensitive text search
UPPER(OWNER) LIKE '%SMITH%'

-- String functions
SUBSTRING(PARCEL_ID, 1, 4) = '1234'

[insert image later]


SQL Validation

Built-in validator checks syntax in real-time.

Real-Time Checks:

  1. Balanced parentheses: Counts opening vs closing parentheses - must match
    • Error: "Unbalanced parentheses: X open, Y close"
  2. Balanced quotes: Counts single quotes - must be even
    • Error: "Unbalanced single quotes in expression"
  3. Logical operators: Checks for incomplete AND/OR at start/end
    • Warning: "Expression ends with incomplete logical operator"
    • Warning: "Expression starts with logical operator"
  4. LIKE patterns: Detects LIKE without % or _ wildcards
    • Info: "Tip: LIKE without % or _ wildcards works like = operator"

Validation Messages:

  • Info (blue): Valid with helpful tip
  • Warning (yellow): Valid but potentially incorrect
  • Error (red): Invalid - query will fail when applied

Common Errors:

sql
-- ❌ Missing closing parenthesis (caught by validator)
(ZONE = 'RES' AND AREA > 0.4

-- ❌ Unbalanced quotes (caught by validator)
OWNER = 'JOHN SMITH

-- ✅ Correct
(ZONE = 'RES' AND AREA > 0.4)
OWNER = 'JOHN SMITH'

Statistics Tool

Purpose

Calculate statistics on filtered feature results using ArcGIS statistics capabilities.

[insert image later]

Technical Implementation:

  • Queries features with statistics calculations
  • Applies current layer filter before calculating statistics
  • Supports only numeric field types: integer, double, single
  • Results displayed in real-time with loading indicator

Available Statistics:

  • Count: Number of features
  • Sum: Total of numeric field values
  • Average: Mean value
  • Minimum: Smallest value
  • Maximum: Largest value
  • Standard Deviation: Measure of variance

How to Calculate Statistics

Location: Filter Panel → Dialog → "Tools" tab (Tab Index 2)

Steps:

  1. Apply filter to layer (Quick Filter or SQL Mode)
  2. Open filter dialog
  3. Navigate to "Tools" tab
  4. Select numeric field from dropdown (integer/double/single types only)
  5. Click "Calculate Statistics" button
  6. Results display in panel with loading indicator
  7. Results persist until new statistics calculated or panel closed

Example Workflow:

1. Filter: ZONE_CODE = 'RES'  (1,234 features matched)
2. Statistics Field: LAND_VALUE (numeric field)
3. Results:
   - Count: 1,234 properties
   - Sum: $456,789,000
   - Average: $370,227
   - Min: $180,000
   - Max: $2,450,000
   - Std Dev: $145,678

[insert image later]


Export Filtered Data

Export Options

After applying filter, export matching features with automatic projection transformation.

Formats:

  • Shapefile: Geometry + attributes with user-selected projection
  • GeoJSON: Web-friendly format (automatically uses WGS84/EPSG:4326)
  • KML: Google Earth format (automatically uses WGS84/EPSG:4326)
  • GPX: GPS Exchange Format (automatically uses WGS84/EPSG:4326)

Technical Implementation:

  • Filtered features queried with current filter WHERE clause
  • Geometries automatically projected to target spatial reference
  • Geographic formats (KML, GPX, GeoJSON) automatically use WGS84 for compatibility
  • Shapefile uses user-selected projection

Projection Options (user-selectable for Shapefile):

  • WGS84 (EPSG:4326) - Global standard
  • GDA2020 (EPSG:7844) - Australian datum
  • GDA94 (EPSG:4283) - Legacy Australian datum
  • MGA Zone 55/56 (EPSG:28355/28356) - Australian projected coordinates
  • Additional projections configurable by admin in database

[insert image later]


Export Workflow

  1. Apply filter to layer
  2. Click "Export" button in Filter panel
  3. Choose export format
  4. Select coordinate system
  5. Enter filename
  6. Click "Export"
  7. File downloads automatically

Filter Workflows

Workflow 1: Development Application Assessment

Scenario: Find properties suitable for subdivision

Steps:

  1. Open Filter panel → SQL Mode
  2. Enter query:
    sql
    ZONE_CODE IN ('RES', 'MIX')
    AND AREA_HA > 0.4
    AND HERITAGE = 'NO'
  3. Apply filter
  4. Review matching properties on map
  5. Calculate statistics on LAND_VALUE
  6. Export results as CSV

[insert image later]


Workflow 2: Infrastructure Maintenance

Scenario: Find assets requiring urgent attention

Steps:

  1. Open Filter → SQL Mode
  2. Enter query:
    sql
    CONDITION IN ('POOR', 'CRITICAL')
    AND LAST_INSPECTION < '2022-01-01'
    AND ASSET_TYPE IN ('BRIDGE', 'CULVERT')
  3. Apply filter
  4. Calculate statistics on REPLACEMENT_COST
  5. Export as Shapefile for field crew

Performance Tips

For Large Datasets:

  • Use indexed fields when possible
  • Limit spatial extent (zoom to area of interest)
  • Use specific values, not broad wildcards
  • Clear filters when done

Fast Queries:

  • FIELD = 'VALUE' (exact match)
  • FIELD IN (value1, value2) (indexed list)
  • FIELD > number (numeric comparison)
  • Simple AND conditions

Slow Queries:

  • LIKE '%TEXT%' (searches entire string)
  • Complex OR with many conditions
  • Functions on large fields

Case Sensitivity Toggle

Location: Filter panel header

When Enabled:

  • Text comparisons are case-insensitive
  • 'Smith' matches 'SMITH', 'smith', 'Smith'
  • Performance may be slightly slower

When Disabled:

  • Exact case match required
  • Faster performance

Clear and Reset Filters

Clear Filter

Remove filter, show all features.

How: Click "Clear Filter" button in panel

Reset Panel

Clear filter AND reset panel to default state.

How: Click "Reset" button


Troubleshooting

"Filter returns no features"

Possible Causes:

  • No features match criteria
  • Typo in field value
  • Case sensitivity issue

Solutions:

  • Verify field values in attribute table first
  • Check spelling and case
  • Try broader filter
  • Enable case-insensitive mode

"Filter is slow"

Causes: Large dataset, complex query, non-indexed fields

Solutions:

  • Zoom to area of interest first
  • Simplify query
  • Use exact matches instead of LIKE
  • Filter in stages

"SQL syntax error"

Common Issues:

sql
-- ❌ Wrong: Includes WHERE
WHERE ZONE = 'RES'

-- ✅ Correct: No WHERE
ZONE = 'RES'

-- ❌ Wrong: Double quotes on text
ZONE = "RES"

-- ✅ Correct: Single quotes
ZONE = 'RES'

-- ❌ Wrong: Unbalanced parentheses
(ZONE = 'RES' AND VALUE > 500000

-- ✅ Correct: Balanced
(ZONE = 'RES' AND VALUE > 500000)

Summary

Advanced Filtering enables precise data queries:

Two Modes:

  • Quick Filter: Fast simple queries
  • SQL Mode: Direct SQL for power users

Key Features:

  • Multiple conditions (AND/OR logic)
  • Real-time validation
  • Statistics on filtered data
  • Export filtered features
  • Case-insensitive options

Best For:

  • Data exploration
  • Compliance checking
  • Subset extraction
  • Planning analysis
  • Asset queries

Remember: Apply filters on visible layers only, and use indexed fields for best performance.