Skip to content

Commit

Permalink
New blog post about spatial queries
Browse files Browse the repository at this point in the history
  • Loading branch information
simonokeefe committed Dec 3, 2024
1 parent adaee80 commit 48d3b5a
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions blog/2024-12-03-best-practice-for-spatial-queries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
slug: best-practice-for-spatial-queries
author: Simon O'Keefe
tags:
description: How to configure Pozi to ensure users know for certain whether a property is affected by any overlay or not
category: Tips
visibility:
---

# Best Practice for Spatial Queries

Dynamic spatial intersections are a powerful component of Pozi's user experience. However, they sometimes require some configuration to ensure users obtain the information they need.

## Use Case

A common use case for Pozi users is to know whether a property is affected by any planning overlay or not.

![Initial What's Here results](../static/img/pozi-best-practice-spatial-query-whats-here-results.png)

Simply clicking on a location on the Pozi map will not trigger the necessary spatial intersection between a property and an overlay.

How do you configure Pozi to ensure users know for certain whether a property is affected by any overlay or not?

## Configuration

### Selectability

Users must not be under the impression that simply clicking on a location on the map will inform them whether a property is affected by any overlay or not. To avoid this, make the overlay layer *unselectable*.

https://pozi.com/admin-guide/qgis/configuring-layers/#selectability

### Child Dataset

The overlay layer needs to be configured as a *child dataset* of the property layer.

If you already have an overlay layer that is used for visualisation purposes, and it's *not* enabled for WFS (which is typically the case to ensure performance and styling of large layers), you'll need a new dedicated layer that *is* enabled for WFS and configured as a child dataset of the property layer.

Duplicate the existing overlay layer in the QGIS project, give the duplicated layer a different name (such as Property Planning Overlays) to avoid conflicting with the existing overlay layer, and enable the layer for WFS. Then add `parent=Property, showInLayerControl=false` to the layer keywords.

https://pozi.com/admin-guide/qgis/configuring-linked-datasets/#spatial-filter

With this configuration, Pozi will trigger a spatial intersection between the parent (Property) and child (Property Planning Overlays) layers when the user selects any property.

## End Result

When the user clicks on the map, the What's Here results will show any features (from the property layer and any other active layers) found at that location. The user selects the desired property feature, and Pozi performs a spatial query between the property and overlay layer. Any intersecting overlays will be displayed under the property details.

This enables the user to know with certainty whether the property is affected by any overlay or not.

## Example

https://horsham.pozi.com/#/x[142.15469]/y[-36.77435]/z[16]/feature[whatshere,142.15469%20-36.77435]/layers[planningoverlays]/

![Initial What's Here results](../static/img/pozi-best-practice-spatial-query-whats-here.png)

From the initial What's Here results, the user selects the desired property by clicking the feature title (ie, the property address).

![Property selection](../static/img/pozi-best-practice-spatial-query-property-selection.png)

Pozi shows that the property is affected by an overlay despite the user not having directly clicked on the overlay feature.

Notes:

- the planning overlays are combined into a single layer, which has major benefits:
- improve performance by reducing the number of WMS requests to the server every time the user zooms or pans the map
- improve user experience by reducing the space taken up in the Info Panel to display the presence or absence of any overlay
- the overlays layer used for visualisation is configured in QGIS as *unselectable*
- a 'Property Planning Overlays' layer is added to QGIS, enabled for WFS, and configured as a *child dataset* of the property layer
- with the 'Property Planning Overlays' layer configured as a child dataset, it is not even necessary for the layer to visible in order for users to see the results of the spatial query
- if your existing overlays layer is already enabled for WFS (which would only be the case if styling and performance are suitable for WFS), you can use it directly as a child dataset of the property layer without adding a separate layer - simply add `parent=Property` to the existing overlay layer keywords
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 48d3b5a

Please sign in to comment.