Skip to content

pygeoapi query samples

Joost van Ulden edited this page Mar 25, 2021 · 16 revisions

Test dataset

Geopackage: https://www.github.com/OpenDRR/data/raw/main/assets/data/bc/multi_hazard_threat/nhsl_hazard_threat_all_indicators_s_bc.gpkg

OGC API Features: https://geo-api.dev.riskprofiler.ca/collections/nhsl_hazard_threat_all_indicators_s

Sample queries

Note: these samples are written in Elasticsearch query syntax

Comparison

Logical

Spatial

Nearest

{
  "query": {
    "geo_shape": {
      "geometry": {
        "shape": {
          "type": "circle",
          "radius": "20km",
          "coordinates": [ -118, 49 ]
        }
      }
    }
  }
}

Bounding Box

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "geo_shape": {
          "geometry": {
            "shape": {
              "type": "envelope",
              "coordinates": [ [ -118.7, 50 ], [ -118.4, 49.9 ] ]
            },
            "relation": "intersects"
          }
        }
      }
    }
  }
}