# 'What's Here' and Other Child Datasets

# Child Datasets

  • "title": use singular name where practical
  • "showInLayerControl": set to false to prevent dataset from being listed in the layer panel.
  • "group": leave blank or undefined

# Non-Spatial Lookups

A child dataset can be used to fetch data about a selected feature from a separate source such as a database or web service. This enables Pozi to return one or more (or none) records that are associated with the selected feature.

Use cases:

  • property owner
  • inspections
  • defects
  • maintenance
  • photos

The child dataset's url will contain a request to a dataset, plus a filter parameter for selecting related rows from the source dataset.

There is no special configuration required for the parent dataset in order for it to support a child dataset. The parent dataset can come from either an external or internal source.

# Filters

Append a filter parameter to the request URL to return only records that match the filter.

  • WFS from QGIS Server: &EXP_FILTER= ChildDatasetIDField in ([ ParentDatasetIDField ])
  • WFS OGC: &FILTER=<Filter><PropertyIsEqualTo><PropertyName> ChildDatasetIDField </PropertyName><Literal>[ ParentDatasetIDField ]</Literal></PropertyIsEqualTo></Filter>
  • VRT: &options=-where| ChildDatasetIDField in ('[ ParentDatasetIDField ]')
  • WFS CQL: &cql_filter= ChildDatasetIDField in ('[ ParentDatasetIDField ]')
  • CKAN Data API: sql=SELECT * from \" Child CKAN Table ID \" WHERE \" ChildDatasetIDField \" IN ('[ ParentDatasetIDField ]')"

This example uses the selected bridge's AssetID value to do a lookup on a table of associated records in a defect table. The defect table is registered as a WFS endpoint in QGIS.

{
  "title": "Bridge Defects",
  "parent": "Bridges",
  "type": "GeoJSON",
  "localDataSource": true,
  "showInLayerControl": false,
  "config": {
    "spatial": {
      "loader": "geojson",
      "url": "https://bs-gis.pozi.com/iis/qgisserver?MAP=//bs-intra/GIS/System/POZI/QGIS%20Projects/Child%20Datasets.qgs&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&OUTPUTFORMAT=application%2Fjson&TYPENAME=POZI_BridgeDefects&FILTER=<Filter><PropertyIsEqualTo><PropertyName>AssetID</PropertyName><Literal>[AssetID]</Literal></PropertyIsEqualTo></Filter>",
      "id": "AssetID",
      "label": "DefectDescription"
    }
  }
}
{
  "title": "Grading Schedule",
  "type": "GeoJSON",
  "parent": "Work Zone for Grading",
  "showInLayerControl": false,
  "config": {
    "spatial": {
      "loader": "ckanapi",
      "url": "https://data.gov.au/data/api/3/action/datastore_search_sql?sql=SELECT * from \"e84991bd-93f8-4cb7-af39-72b933682f08\" WHERE \"WORK_ZONE\" IN ('[work_zone]')"
    }
  }
}

# Spatial Intersection

When a dataset is configured with the "pointOnSurface": true transformer function, Pozi filters the dataset to only those records that intersect with the parent geometry.

  "config": {
    "transformer": {
      "pointOnSurface": true
    }
  }

The pointOnSurface calculation is done in the browser after it has fetched all the records from the source. This can cause inefficiencies if the source data contains a lot of records.

# What's Here Datasets

What's Here is a special case of a child dataset whose parent is the geometry generated by the user's map click (or polygon drawn from the Select by region tool).

  "parent": "Whats Here",

Notes:

  • the "Whats Here" value in the config does NOT contain an apostrophe
  • setting the parent to "Whats Here" is also currently used as a hack for WMS layers to force the results of any GetFeatureInfo request to appear in the info panel (however there is a plan to avoid the need for this hack)

# Static Datasets

If the source of a What's Here dataset is a static GeoJSON, the configuration requires the "pointOnSurface": true transformer function.

{
  "title": "Work Zone for Grading",
  "type": "GeoJSON",
  "parent": "Whats Here",
  "showInLayerControl": false,
  "config": {
    "spatial": {
      "loader": "geojson",
      "url": "https://data.gov.au/data/dataset/3384d5aa-4c1c-4e4b-b58a-6ce1ebb75abc/resource/2e9ce837-8699-4523-839e-4548e11546d9/download/ssc_work_zones_epsg4326_polygon.geojson"
    },
    "transformer": {
      "pointOnSurface": true
    }
  }
}

# Dynamic Datasets

If the source of a What's Here dataset is an API such as WFS, CKAN or Street View, the request URL needs to include parameter(s) which describes the target geometry:

  • $cqlgeometry or $cqlgeometrysimplified
  • $wkt
  • $gml
  • $esriGeometry & $esriGeometryType
  • $longitude & $latitude

A complete list of geometry parameters is available here (developer login required).

{
  "title": "Street View",
  "type": "Image",
  "parent": "Whats Here",
  "showInLayerControl": false,
  "config": {
    "spatial": {
      "url": "https://proxy.pozi.com/https://maps.googleapis.com/maps/api/streetview?size=340x105&location=[$latitude],[$longitude]&authkey=streetview",
      "href": "http://maps.google.com.au/maps?layer=c&cbll=[$latitude],[$longitude]"
    }
  }
}
{
  "title": "Property Planning Zones",
  "type": "GeoJSON",
  "parent": "Property",
  "showInLayerControl": false,
  "config": {
    "spatial": {
      "url": "https://opendata.maps.vic.gov.au/geoserver/ows?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&srsName=EPSG:4326&typeNames=plan_zone&maxFeatures=1000&outputFormat=application%2Fjson&cql_filter=intersects(geom,[$cqlgeometrysimplified])",
      "label": "zone_description",
      "id": "pfi"
    }
  }
}