How to use buffers (TQL): Difference between revisions
(Created page with "The TQL BUFFER statement can allow queries to retrieve data not just within a specified contour, but in the vicinity as well. It does not affect the results found, only the re...") |
mNo edit summary |
||
Line 4: | Line 4: | ||
==How buffers are applied== | ==How buffers are applied== | ||
Making effective use of the [[TQL]]'s [[BUFFER]] clause can be tricky, due to how it exactly affects the selection. | Making effective use of the [[TQL]]'s [[TQL#Transformations|BUFFER]] clause can be tricky, due to how it exactly affects the selection. | ||
The BUFFER clause affects the intermediate polygon selection of TQL. When a query makes a selection for, for example, | The BUFFER clause affects the intermediate polygon selection of TQL. When a query makes a selection for, for example, [[TQL#Construction polygons|LOTSIZE]], the clauses indicate within which selection polygon that lotsize should be present. 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 queries to find all the lotsize 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 can 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 can be found. | ||
Line 44: | Line 44: | ||
==Consideration when using buffers== | ==Consideration when using buffers== | ||
When using buffers, take the following into consideration: | 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 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 constructions. | ||
* When buffering based on grids, take into account the grid size in respect the the buffer size. If the buffer size is not greater than the [[grid 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 the 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. | ||
* 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 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 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. |
Revision as of 12:53, 3 October 2019
The TQL BUFFER statement can allow queries to retrieve data not just within a specified contour, but in the vicinity as well. It does not affect the results found, only the region in which results can be found.
Without buffers, this would require manually creating additional polygons, such as areas, which are themselves created to be larger by a fixed buffer. Now it's possible to perform these operations without additional geographical data.
How buffers are applied
Making effective use of the TQL's BUFFER clause can be tricky, due to how it exactly affects the selection.
The BUFFER clause affects the intermediate polygon selection of TQL. When a query makes a selection for, for example, LOTSIZE, the clauses indicate within which selection polygon that lotsize should be present. The selection polygon is computed by the overlap of clauses such as AREA and MINGRIDVALUE. After this selection polygon is computed, it is queries to find all the lotsize 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 can be found.
How to use buffers to retrieve data
Using buffers, it is possible to find results both within a specified area, as well as in the direct vicinity. For example, consider a use-case where green near a neighborhood should be found.
To find green, the following statement can be created:
SELECT_LOTSIZE_WHERE_FUNCTIONMULT_IS_GREEN_M2
To find green only in a specific neighborhood:
SELECT_LOTSIZE_WHERE_FUNCTIONMULT_IS_GREEN_M2_AND_NEIGHBORHOOD_IS_1
*
(*Assuming neighborhood 1 is the intended neighborhood)
To find green in and in an area of 50 meters around a specific neighborhood:
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 constructions. For example, consider a use-case where constructions 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 constructions 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
Consideration when using buffers
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 constructions.
- When buffering based on grids, take into account the grid size in respect the 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.
- Buffers cannot be negative. It is not possible to shrink a selection polygon.
- When using a buffer 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.