How to use buffers (TQL): Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
With the [[TQL#Transformations|BUFFER]] clause of [[TQL]], it is possible to retrieve data not just within a specified contour, but in the vicinity of this contour (specified with a distance) as well.  
With the [[Buffer (TQL Param)]] clause of [[TQL]], it is possible to retrieve data not just within a specified contour, but in the vicinity of this contour (specified with a distance) as well.  


==How buffers are applied==
==How buffers are applied==
[[File:buffer_function.jpg|300px|thumb|right|The red line shows the buffer around the selection polygon (yellow) for a LOTSIZE query based on a grid.]]
[[File:buffer_function.jpg|300px|thumb|right|The red line shows the buffer around the selection polygon (yellow) for a LOTSIZE query based on a grid.]]


The BUFFER clause affects the polygon selection of the TQL query. When a query makes a selection for, for example, [[TQL#Construction polygons|LOTSIZE]], the clauses indicate in which selection polygon you want to find the lotsize. The selection polygon is computed by the overlap of clauses such as [[TQL#Specific polygons|AREA]] and [[TQL#Grids|MINGRIDVALUE]]. After this selection polygon is computed, it is queried to find all the relevant lotsizes within.
The BUFFER clause affects the polygon selection of the TQL query. When a query makes a selection for, for example, [[TQL#Building polygons|LOTSIZE]], the clauses indicate in which selection polygon you want to find the lotsize. The selection polygon is computed by the overlap of clauses such as [[TQL#Specific polygons|AREA]] and [[TQL#Grids|MINGRIDVALUE]]. After this selection polygon is computed, it is queried to find all the relevant lotsizes within.


The buffer is applied after computing the selection polygon, but before finding the lotsize inside the selection polygon. The selection polygon is buffered with the indicated amount to create a larger selection polygon, in which more lotsize may be found.
The buffer is applied after computing the selection polygon, but before finding the lotsize inside the selection polygon. The selection polygon is buffered with the indicated amount to create a larger selection polygon, in which more lotsize may be found.
Line 25: Line 25:


==How to use buffers to write data==
==How to use buffers to write data==
Buffers can also be used in combination with grids to conditionally write data to [[construction]]s. For example, consider a use-case where constructions with water nearby should be marked as "threatened".
Buffers can also be used in combination with grids to conditionally write data to [[building]]s. For example, consider a use-case where buildings with water nearby should be marked as "threatened".


To find constructions with water on them:  
To find buildings with water on them:  


<code>SELECT_LOTSIZE_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1</code>*<br>
<code>SELECT_LOTSIZE_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1</code>*<br>
(*Assuming grid 4 is a [[Water Overlay]]'s [[Surface last value result type (Water Overlay)|SURFACE_LAST_VALUE result type]], and the relevant amount of water is 10cm)
(*Assuming grid 4 is a [[Water Overlay]]'s [[Surface last value result type (Water Overlay)|SURFACE_LAST_VALUE result type]], and the relevant amount of water is 10cm)


How to write an attribute (THREATENED) to constructions with water on them:  
How to write an attribute (THREATENED) to buildings with water on them:  


<code>UPDATE_BUILDING_THREATENED_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1</code>
<code>UPDATE_BUILDING_THREATENED_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1</code>


How to update constructions with water not just on them, but also within 1 meter of the water:
How to update buildings with water not just on them, but also within 1 meter of the water:


<code>UPDATE_BUILDING_THREATENED_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1_AND_BUFFER_IS_1</code>
<code>UPDATE_BUILDING_THREATENED_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1_AND_BUFFER_IS_1</code>


==Notes==
{{article end
|notes=
When using buffers, take the following into consideration:
When using buffers, take the following into consideration:
* Buffers only apply to selection polygons. This includes [[TQL#Specific polygons|specific polygons]], [[TQL#Attribute polygons|attribute polygons]], and [[TQL#Grids|grids]], but not individual [[TQL#Constructions|constructions]].
* Buffers only apply to selection polygons. This includes [[TQL#Specific polygons|specific polygons]], [[TQL#Attribute polygons|attribute polygons]], and [[TQL#Grids|grids]], but not individual [[TQL#Buildings|buildings]].
* When a buffer clause is used to extend a selection polygon, the new selection polygon includes both the original selection polygon as well as the buffer around it.
* When a buffer clause is used to extend a selection polygon, the new selection polygon includes both the original selection polygon as well as the buffer around it.
* When buffering based on grids, take into account the grid size in respect to the buffer size. If the buffer size is not greater than the [[grid cell size]] some vector-based data such as constructions may be less likely to be in range of the grid-based data.
* When buffering based on grids, take into account the grid size in respect to the buffer size. If the buffer size is not greater than the [[grid cell size]] some vector-based data such as buildings may be less likely to be in range of the grid-based data.
* Buffers cannot be negative. It is not possible to shrink a selection polygon.
* Buffers cannot be negative. It is not possible to shrink a selection polygon.
* When using a BUFFER clause to create a selection polygon, it is not possible to automatically create an inverse selection. I.e. for a query looking for grid values higher than a certain value and a query looking for grid values lower than that same value, the selection polygons are effective complementary. However, when the queries are buffered, the two selection polygons will overlap.
* When using a BUFFER clause to create a selection polygon, it is not possible to automatically create an inverse selection. I.e. for a query looking for grid values higher than a certain value and a query looking for grid values lower than that same value, the selection polygons are effective complementary. However, when the queries are buffered, the two selection polygons will overlap.
* By using the [[TQL#Construction polygons|LOTPOLYGONS]] clause in combination with the buffer clause, it is is possible to see the created buffer selection polygon.
* By using the [[TQL#Building polygons|LOTPOLYGONS]] clause in combination with the buffer clause, it is is possible to see the created buffer selection polygon.
|seealso=
* [[Buffer (TQL Param)]]
* [[TQL]]
}}
 
[[Category:How-to's]]

Latest revision as of 16:21, 30 January 2024

With the Buffer (TQL Param) clause of TQL, it is possible to retrieve data not just within a specified contour, but in the vicinity of this contour (specified with a distance) as well.

How buffers are applied

The red line shows the buffer around the selection polygon (yellow) for a LOTSIZE query based on a grid.

The BUFFER clause affects the polygon selection of the TQL query. When a query makes a selection for, for example, LOTSIZE, the clauses indicate in which selection polygon you want to find the lotsize. The selection polygon is computed by the overlap of clauses such as AREA and MINGRIDVALUE. After this selection polygon is computed, it is queried to find all the relevant lotsizes within.

The buffer is applied after computing the selection polygon, but before finding the lotsize inside the selection polygon. The selection polygon is buffered with the indicated amount to create a larger selection polygon, in which more lotsize may be found.

How to use buffers to retrieve data

Consider a use-case where the amount of green near a neighborhood should be retrieved.

To find the amount of green, the following statement can be created:

SELECT_LOTSIZE_WHERE_FUNCTIONMULT_IS_GREEN_M2

To find the amount of green only in neighborhood 1:

SELECT_LOTSIZE_WHERE_FUNCTIONMULT_IS_GREEN_M2_AND_NEIGHBORHOOD_IS_1

To find the amount of green in neighborhood 1 and in an area of 50 meters around neighborhood 1:

SELECT_LOTSIZE_WHERE_FUNCTIONMULT_IS_GREEN_M2_AND_NEIGHBORHOOD_IS_1_AND_BUFFER_IS_50

How to use buffers to write data

Buffers can also be used in combination with grids to conditionally write data to buildings. For example, consider a use-case where buildings with water nearby should be marked as "threatened".

To find buildings with water on them:

SELECT_LOTSIZE_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1*
(*Assuming grid 4 is a Water Overlay's SURFACE_LAST_VALUE result type, and the relevant amount of water is 10cm)

How to write an attribute (THREATENED) to buildings with water on them:

UPDATE_BUILDING_THREATENED_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1

How to update buildings with water not just on them, but also within 1 meter of the water:

UPDATE_BUILDING_THREATENED_WHERE_GRID_IS_4_AND_MINGRIDVALUE_IS_0.1_AND_BUFFER_IS_1

Notes

When using buffers, take the following into consideration:

  • Buffers only apply to selection polygons. This includes specific polygons, attribute polygons, and grids, but not individual buildings.
  • When a buffer clause is used to extend a selection polygon, the new selection polygon includes both the original selection polygon as well as the buffer around it.
  • When buffering based on grids, take into account the grid size in respect to the buffer size. If the buffer size is not greater than the grid cell size some vector-based data such as buildings may be less likely to be in range of the grid-based data.
  • Buffers cannot be negative. It is not possible to shrink a selection polygon.
  • When using a BUFFER clause to create a selection polygon, it is not possible to automatically create an inverse selection. I.e. for a query looking for grid values higher than a certain value and a query looking for grid values lower than that same value, the selection polygons are effective complementary. However, when the queries are buffered, the two selection polygons will overlap.
  • By using the LOTPOLYGONS clause in combination with the buffer clause, it is is possible to see the created buffer selection polygon.

See also