mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-03 00:14:12 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
{
 | 
						|
  "name": "get_feature",
 | 
						|
  "type": "function",
 | 
						|
  "groups": ["Record and Attributes"],
 | 
						|
  "description": "Returns the first feature of a layer matching a given attribute value.",
 | 
						|
  "variants": [{
 | 
						|
    "variant": "Single value variant",
 | 
						|
    "variant_description": "Along with the layer ID, a single column and value are specified.",
 | 
						|
    "arguments": [{
 | 
						|
      "arg": "layer",
 | 
						|
      "description": "layer name or ID"
 | 
						|
    }, {
 | 
						|
      "arg": "attribute",
 | 
						|
      "description": "attribute name to use for the match"
 | 
						|
    }, {
 | 
						|
      "arg": "value",
 | 
						|
      "description": "attribute value to match"
 | 
						|
    }],
 | 
						|
    "examples": [{
 | 
						|
      "expression": "get_feature('streets','name','main st')",
 | 
						|
      "returns": "first feature found in \"streets\" layer with \"main st\" value in the \"name\" field"
 | 
						|
    }]
 | 
						|
  }, {
 | 
						|
    "variant": "Map variant",
 | 
						|
    "variant_description": "Along with the layer ID, a map containing the columns (key) and their respective value to be used.",
 | 
						|
    "arguments": [{
 | 
						|
      "arg": "layer",
 | 
						|
      "description": "layer name or ID"
 | 
						|
    }, {
 | 
						|
      "arg": "attribute",
 | 
						|
      "description": "Map containing the column and value pairs to use"
 | 
						|
    }],
 | 
						|
    "examples": [{
 | 
						|
      "expression": "get_feature('streets',map('name','main st','lane_num','4'))",
 | 
						|
      "returns": "first feature found in \"streets\" layer with \"main st\" value in the \"name\" field and  \"4\" value in the \"lane_num\" field"
 | 
						|
    }]
 | 
						|
  }],
 | 
						|
  "tags": ["attribute", "first", "matching", "search", "find"]
 | 
						|
}
 |