mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			48 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
{
 | 
						|
  "name": "overlay_within",
 | 
						|
  "type": "function",
 | 
						|
  "groups": ["GeometryGroup"],
 | 
						|
  "description": "Returns whether the current feature is spatially within at least one feature from a target layer, or an array of expression-based results for the features in the target layer that contain the current feature.<br><br>Read more on the underlying GEOS \"Within\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Within.html'>ST_Within</a> function.",
 | 
						|
  "arguments": [{
 | 
						|
    "arg": "layer",
 | 
						|
    "description": "the layer whose overlay is checked"
 | 
						|
  }, {
 | 
						|
    "arg": "expression",
 | 
						|
    "description": "an optional expression to evaluate on the features from the target layer. If not set, the function will just return a boolean indicating whether there is at least one match.",
 | 
						|
    "optional": true
 | 
						|
  }, {
 | 
						|
    "arg": "filter",
 | 
						|
    "description": "an optional expression to filter the target features to check. If not set, all the features will be checked.",
 | 
						|
    "optional": true
 | 
						|
  }, {
 | 
						|
    "arg": "limit",
 | 
						|
    "description": "an optional integer to limit the number of matching features. If not set, all the matching features will be returned.",
 | 
						|
    "optional": true
 | 
						|
  }, {
 | 
						|
    "arg": "cache",
 | 
						|
    "description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
 | 
						|
    "optional": true,
 | 
						|
    "default": "false"
 | 
						|
  }],
 | 
						|
  "examples": [{
 | 
						|
    "expression": "overlay_within('regions')",
 | 
						|
    "returns": "TRUE if the current feature is spatially within a region"
 | 
						|
  }, {
 | 
						|
    "expression": "overlay_within('regions', filter:= population > 10000)",
 | 
						|
    "returns": "TRUE if the current feature is spatially within a region with a population greater than 10000"
 | 
						|
  }, {
 | 
						|
    "expression": "overlay_within('regions', name)",
 | 
						|
    "returns": "an array of names, for the regions containing the current feature"
 | 
						|
  }, {
 | 
						|
    "expression": "array_to_string(overlay_within('regions', name))",
 | 
						|
    "returns": "a string as a comma separated list of names, for the regions containing the current feature"
 | 
						|
  }, {
 | 
						|
    "expression": "array_sort(overlay_within(layer:='regions', expression:=\"name\", filter:= population > 10000))",
 | 
						|
    "returns": "an ordered array of names, for the regions containing the current feature and with a population greater than 10000"
 | 
						|
  }, {
 | 
						|
    "expression": "overlay_within(layer:='regions', expression:= geom_to_wkt($geometry), limit:=2)",
 | 
						|
    "returns": "an array of geometries (in WKT), for up to two regions containing the current feature"
 | 
						|
  }],
 | 
						|
  "tags": ["predicate", "current", "contain", "target", "array", "geos", "described", "underlying", "features"]
 | 
						|
}
 |