Skip to content
Child Datasets

Child Datasets

A child dataset contains complementary attributes that relate to a selected feature from a map layer.


Parent and child records

When a user selects a feature from a map layer, the parent dataset, Pozi fetches and displays records from any suitably configured table, the child dataset, based on spatial or non-spatial criteria.

Typical use cases include:

  • click on a Property feature to reveal:
    • owner details
    • building and planning permits
    • animal registrations
    • associated land parcels
    • intersecting planning zones and overlays
  • click on an Asset feature to reveal:
    • inspections
    • defects
    • maintenance
    • photos
  • click on a Council Ward feature to reveal:
    • representatives and contact details
  • other related records or reference layers

The parent record contains various attributes, such as those visible in the Details pane, other hidden attributes, and the record’s geometry. Any of these can be used as a key for querying other datasets. Any child record can also become a parent of another dataset, and so on.

In the screenshot above:

  • Property Information is queried using the parent record’s property number
  • Property Parcels is queried using the parent record’s property PFI
  • Property Planning Overlays and Zones both use the parent record’s geometry, ie the property boundary, in a spatial intersection query

Administrators can use QGIS to configure child datasets for viewing by internal users. The parent dataset can be an internal or external dataset.

Joined Datasets vs Child Datasets

Before configuring a child dataset, you may also want to consider using a joined dataset.

Joined Datasets

Joined datasets take advantage of QGIS’s built-in table join function.

Configuring joined tables in QGIS may be suitable when:

  • there is a one-to-one relationship between records in the parent and child tables
  • the table has fewer than 10,000 records, although larger tables may still work slowly
  • users expect to search on joined attributes or view them in a table

Think of joined tables as adding fields from one table to another. Attributes from joined tables appear in the Pozi info panel in the same information tab as the parent dataset.

Keep in mind that joined datasets can add overhead. If the join is calculated on the fly, selection, info-panel loading, and general layer responsiveness may slow down, especially on larger datasets.

If you decide a joined dataset is right for you, see the QGIS documentation for joining features between layers.

The remainder of the instructions on this page are not relevant to joined datasets.

Child Datasets

Alternatively, adding child datasets, as covered on this page, is recommended when:

  • there is a one-to-many relationship between records in the tables, or
  • the table has more than 10,000 records, or
  • the child dataset is a spatial layer and uses a spatial relationship to link to its parent

Attributes from child tables appear in the Pozi info panel in separate tabs below the parent’s information tab.

If you decide a child dataset is right for you, continue to the instructions below.

Add

Add the source table for the child dataset to a QGIS project. The project can be an existing project that contains map layers, or it can be a dedicated project that contains no layers and only child datasets.

  1. open the project file in QGIS
  2. Layer > Add Layer > pick from file or database options
  3. pick the source table
  4. Add
  5. Close
  6. Project > Properties > QGIS Server
  7. WFS capabilities > Published: tick on for the new dataset
  8. OK
  9. Project > Save (Ctrl + S)

Configure

The parent/child settings are maintained in the child layer’s QGIS Server keyword list. Pozi obtains these settings, along with any other keywords, when it loads and imports a project’s catalogue.

QGIS Server keyword list

Only the child dataset needs to be configured with the keyword settings. The parent dataset needs no configuration to be used by a child dataset.

Below are details of how to derive and combine the components of the keyword setting.

Parent

The parent dataset contains the features which, when selected, trigger a data request to the child dataset.

For example, if the parent is the Property layer, then every time a user selects a feature in the Property layer, Pozi triggers a request to the child dataset.

Example:

Layer Properties > QGIS Server > Keyword list
parent=Property

The parent layer can exist in the same QGIS project, a different project, or even a layer from an external source.

Parameter

A parameter expression can be used to override certain parameters for the WFS GetFeature request. A common use of this feature is to provide instructions for filtering the child dataset so that it returns only records that relate to an individual parent feature.

Custom filters can affect performance. Joined datasets and child datasets that rely heavily on parameter=EXP_FILTER may take longer to respond, so test them on realistic data volumes before relying on them in production.

The following are some examples of how parameter can be used. Multiple parameters can be assigned by using a semicolon as a delimiter.

Spatial Filter

Default

If you are configuring a child dataset as a spatial intersection of its parent, you do not need to specify any parameter filter. In the absence of any filter, Pozi assumes that the parent/child relationship is a spatial intersection, and it generates the necessary query to return all child records that intersect the selected parent feature.

Keyword for spatial intersection

If you want to explicitly specify the spatial intersection filter, you can do so by using the following:

Layer Properties > QGIS Server > Keyword list
parent=Property, parameter=filter=<Filter><Intersects><PropertyName>geometry</PropertyName>[$gml]</Intersects></Filter>
Custom

Instead of a standard spatial intersection query, you can configure a custom spatial query using the parameter keyword.

Pick one of the examples below, depending on whether your source dataset is projected or not.

Layer Properties > QGIS Server > Keyword list
parent=Property, parameter=EXP_FILTER=intersects(@geometry [$comma] buffer(geom_from_wkt('[$wkt]') [$comma] 0.00001 ))

In this example, a positive buffer is applied to the parent geometry to return any features that are within a specified distance, specified as 0.00001 of a degree, which is approximately 1 m. Alternatively, a negative buffer can be used to exclude records that have less than approximately 1 m overlap, specified as -0.00001 of a degree.

Note that [$comma] is required in place of a normal comma because QGIS treats a normal comma as a keyword delimiter.

Use this decimal degree table to choose approximate degree values for your required distances:

Degree Value Conversion
Decimal PlacesDecimal DegreesN/S or E/W at equatorE/W at 23 deg N/SE/W at 45 deg N/SE/W at 67 deg N/S
01.0111 km102 km78.7 km43.5 km
10.111.1 km10.2 km7.87 km4.35 km
20.011.11 km1.02 km0.787 km0.435 km
30.001111 m102 m78.7 m43.5 m
40.000111.1 m10.2 m7.87 m4.35 m
50.000011.11 m1.02 m0.787 m0.435 m

Non-Spatial Filter

If you are configuring a child dataset to use an ID-based join, use the layer’s Query Builder to construct and test a filter expression.

  1. Layer Properties > Source > Query Builder
  2. double-click the name of the field to be used as the link. It will be added to the expression
  3. click IN, and add an open bracket (
  4. click the Sample button to obtain a list of existing values from the target field
  5. double-click one of the sample values to add it to the expression
  6. add a close bracket )
  7. click Test

QGIS Query Builder

If the test query returns one or more rows, your expression is valid and can be used in the child parameter. Clear the Query Result dialog box, select your expression text, and copy it to your clipboard.

Exit the Query Builder by clicking Cancel. Do not click OK. If you accidentally click OK, reopen the Query Builder and clear the expression before saving.

Construct the parameter text as follows:

  1. parameter= + EXP_FILTER= + the expression from your test pasted from the clipboard
  2. remove any double quotes from around the target field
  3. replace the sample value with the name of the link field from the parent dataset where the target value is obtained, enclosed in square brackets, for example replace 1000900200 with [Property Number]

Example:

Layer Properties > QGIS Server > Keyword list
parent=Property, parameter=EXP_FILTER=Assess_NumberX IN ('[Property Number]')

Pozi will substitute any field names within square brackets with values from those fields from the parent.

Field name format

The EXP_FILTER does not support spaces in the child dataset’s lookup field name. If this field contains spaces, configure an alias name for the field using the dataset’s Attributes Form settings.

Ordering

To ensure child data is returned in a logical order, the SORTBY parameter can be used. By default, the specified field is sorted in ascending order. To reverse the order, append DESC after the field name.

In the following example, a playground inspection dataset is linked to the parent Playgrounds layer using the asset_id field in both datasets. The data is sorted so that the most recent inspection is returned first by using the SORTBY=inspection_date DESC parameter.

Layer Properties > QGIS Server > Keyword list
parent=Playgrounds, parameter=EXP_FILTER=asset_id in ('[asset_id]');SORTBY=inspection_date DESC

This example demonstrates the use of a semicolon to specify multiple parameters.

Return Geometry

There are instances when returning the actual geometry for a child dataset is not desired. An example is when the child layer includes very complex geometries, such as flooding or bushfire-prone layers, which can result in excessively large datasets being returned and can significantly affect application performance.

The GEOMETRYNAME parameter can be used to alter the geometry that is returned. The supported values are extent, centroid, and none.

Example: parameter=GEOMETRYNAME=none

Optional Settings

These settings provide an override for some of the default layer behaviours in Pozi.

SettingDescription
enabled=falsedisable a dataset in Pozi
showInLayerControl=falsedo not display the layer in the layer panel
downloadable=falseprevent Pozi from showing a table view of the selected features
infoPanelCollapse=truecollapse the info results panel for this dataset
promoteDetails=truedisplay all child attributes instead of a preview

Combine and Configure

In the child dataset’s Layer Properties, go to QGIS Server. Fill in the Keyword list with the parent, parameter, and any optional settings derived above, each separated by commas.

QGIS Server keyword list

  • Spatial example: parent=Property
  • Non-spatial example: parent=Property, parameter=EXP_FILTER=Assess_NumberX in ('[Property Number]')

Click OK, then save the project.

Open your Pozi site in your browser, refresh the page, click on the map, select a parent record, and confirm that you can see the related child record or records in the info panel.

Pozi automatically prevents the child table from appearing in the layer panel due to the presence of the parent keyword. Do not add the table to the list of excluded layers in the QGIS Server settings unless you want to disable the child dataset lookup.

Last updated on