Tile SQL Functions

This topic covers functions built into the Manifold query engine, called SQL functions or query functions,  that begin with Tile.   Functions that begin with Tile manipulate tiles and pixels within tiles, as used within raster images.  Tile functions provide a huge range of functions for working with raster data.  Tile functions do mathematics on tiles, provide comparisons, or create vector objects from tiles, for example, TileContourLines, or rasters from vectors, for example, TileInterpolateKriging.

 

The Manifold query engine also supports declaring and calling functions, including script functions, functions in external files and compiled functions as .NET assemblies.  

 

 

 

Manifold has so many SQL functions they have been grouped into several topics:

 

 

 

 

 

 

 

 

The list of functions below uses the same nomenclature as the function templates in the Query Builder.  SQL functions take arguments as specified in angle < > brackets.  The data type or value type the function returns is given after the : colon.    For example, Chr(<value>) : <string> takes a numeric <value> and returns a text <string>, as noted in the description a string that is a single character.   CoordSystems() : <table> takes no arguments and returns a table.

 

Examples in the list below which use an ? expression evaluation command are intended to be run in a Command Window.   Do not add a semicolon ; character when using the ? command in a Command window.  When using the ? command we use CALL when the function returns more than just a value, for example, when it returns a table.

 

Indexes are always zero based: for example, in an object consisting of three branches the first branch is branch 0, the second is branch 1 and the third is branch 2.

 

This is a long list, so to find a function it is best when viewing this topic in a browser to do a Ctrl-F to open a Find box and to enter the function name of interest to be able to jump to that function.  The list in this topic is comprehensive but new items are often added with updates to Manifold and may appear in the product before they appear in this documentation.   See the list in the query builder tab of the Command Window for an authoritative list of operators, commands and functions.

Constants

See the Identifiers, Constants and Literals topic for some useful constants.   For information on functions that use a <filter> argument or which produce a filter definition matrix, see the How Matrix Filters Work topic.

Functions

 Numeric functions on tiles operate on the first channel in the tile, ignoring all other channels, in the case of images that have more than one channel.

 

TileAbs(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the absolute value of the input tile pixel values.   Absolute value leaves positive numbers unchanged and converts negative numbers into their positive equivalents.  

TileAcos(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the arc cosine (inverse cosine) of the input tile pixel values.

TileAcosh(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the hyperbolic arc cosine of the input tile pixel values.

TileAsin(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the arc sine (inverse sine) ofthe input tile pixel values.

TileAsinh(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the hyperbolic arc sine of the input tile pixel values.

TileAspect(<tile>, <radius>, <scalex3>) : <tile>

Given a tile value, a radius, and XYZ scales, returns a tile with pixel values set to the aspect in degrees of the surface implied by treating input tile pixel values as heights.  GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  

TileAtan(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the arc tangent (inverse tangent) of the input tile pixel values.

TileAtan2(<y>, <x>) : <tile>

Given a tile value returns a tile with pixel values set to the arc tangent (inverse tangent) of the ratio between the DY field and the DX field specified.

TileAtanh(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the hyperbolic arc tangent of  the input tile pixel values.

TileBgrHcy(<tilebgr>) : <tilehcy>

Given a tile value with pixels in BGR color space returns a tile with pixel values in HCY (Hue, Chroma, Luminance) color space. "Luminance" is often referred to as "Y".    This color space is often known as HCL (Hue, Chroma, Luminance).

TileBgrHsi(<tilebgr>) : <tilehsi>

Given a tile value with pixels in BGR color space returns a tile with pixel values in HSI (Hue, Saturation, Intensity) color space.

TileBgrHsl(<tilebgr>) : <tilehsl>

Given a tile value with pixels in BGR color space returns a tile with pixel values in HSL (Hue, Saturation, Lightness) color space.

TileBgrHsv(<tilebgr>) : <tilehsv>

Given a tile value with pixels in BGR color space returns a tile with pixel values in HSV (Hue, Saturation, Value) color space.  Often referred to as HSB (Hue, Saturation, Brightness) color space.

TileCbrt(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to cubic root of the input tile pixel values.

TileCeil(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the rounded up integer value of the input tile pixel values.

TileCeilDecs(<tile>, <decimals>) : <tile>

Given a tile value and the desired number of decimals returns a tile with pixel values set to the integer value rounded up to the specified number of decimals of the input tile pixel values.

TileChannel(<tile>, <channel>) : <tile>

Given a tile value returns a tile with pixel values set to the values in the designated channel of the input tile.

TileChannelCopy(<tile>, <channel>, <tileSource>, <channelSource>): <tile>

Given a source tile and source channel, and a destination tile and destination channel, copies pixel values from the source channel in the source tile into the destination channel in the destination tile.   Source and destination tiles must be the same dimension.  Source and destination pixel data types can be different, with conversion automatically being done on the fly.  

TileChannelCount(<tile>) : <value>

Given a tile value returns the number of channels in the tile.  For example, a tile containing uint8x3 pixel values will have three channels.

TileChannels(<tile>, <value/valuexN>) : <tile>

Rearrange the component parts of a pixel value vector within a tile as directed by an index vector, similar to how the VectorValues function rearranges component parts of a vector value.  The VectorValues function rearranges the component parts of a single vector value.   The TileChannels function rearranges the component parts of all pixel value vectors in the tile.  

 

For example, if a tile is composed of uint8x3 vector values for each pixel where the three parts of the uint8x3 vector represent B, G and R channel values, applying TileChannels function to that tile using an index vector set of {2,1,0} will reshuffle the values so the uint8x3 vector will contain R, G and B channel values.   See the discussion for the VectorValues function.

 

Passing a single value makes TileChannels work like TileChannel, extracting a single channel from potentially multi-channel data. The number of channels in the tile returned by TileChannels does not have to be the same as the  number of channels in the original tile.

 

For example, executing an expression in the Command Window using TileMake to construct an example tile from which we will take a channel:

 

? TileJson(TileChannels(TileMake(3, 3, VectorMakeX3(160, 192, 255)), 1))

nvarchar: [

 192, 192, 192,

 192, 192, 192,

 192, 192, 192

]

 

The above extracts the second channel (Channel 1 in zero-based counting) from a three channel tile.

 

For example, we can add an extra channel not in the original tile:

 

? TileJson(TileChannels(TileMake(3, 3, 255), VectorMakeX4(0, 0, 0, -1)))

nvarchar: [

 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,

 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,

 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0

]

 

The above fills the first three channels with the original first channel (Channel 0 in zero-based counting) and then adds an extra channel filled with zeros.

 

See the Example: Rearrange Channels using an Expression topic for an example using TileChannels to change BGR channel order to RGB channel order.

TileChannelsConcat(<tile>, <tileConcat>) : <tile>

 

TileChannelsConcatFill(<tile>, <tileConcat>) : <tile>

Given a tile and a second tile of the same dimensions, concatenates the second tile's channels onto the first tile, returning a tile with concatenated channels up to a total of four channels.  

 

Using the TileChannelsConcat  function, pixels will be visible if they are visible in both of the concatenated tiles.  Using the TileChannelsConcatFill function, pixels will be visible if they are visible in either of the concatenated tiles, and any missing channel values will be filled with zeros.

 

For example, if the first tile called [BG Tile] has uint8x2 values, that is, a vector value with two parts, that represent B and G values for an image, and a second tile called [R Tile] has a single uint8 value for each pixel that represents R values, then:

 

TileChannelsConcat([BG Tile], [R Tile])

 

Returns a tile with pixel values as uint8x3 three part vectors that represent  B, G and R values.

TileClear(<tile>): <tile>

Given a tile, returns a tile with all pixels set to invisible.  

 

With the focus on the image shown above, in the Transform pane we choose the Expression tab.

We enter the expression:

 

TileClear([Tile])

 

The image disappears.  If in the Layers pane we turn off the background layer, we can see the default checkerboard pattern, since all pixels in the image are now transparent.

 

TileCompare(<tile>, <tile>) : <tile>

This function has been removed, since the Compare SQL Operator does everything it did and more.

TileContourArea(<image>, <channel>, <heightMin>, <heightMax>) : <geom>

Takes a raster image with terrain heights in the specified channel, minimum contour height, maximum contour height and returns a single contour area for the specified height range. If none of the image pixels is in the specified height range, the function returns a NULL value.

 

Example: create a single contour area:

 

VALUES (TileContourArea([german_alps], 0, 1000, 2000));

 

TileContourAreaPar(<image>, <channel>, <heightMin>, <heightMax>, <config>): <geom>

A parallel form of the TileContourArea function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileContourArea function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileContourAreas(<image>, <channel>, <heights>, <split>): <table>

Takes a raster image with terrain heights in the specified channel, and a set of desired contour heights specified as a table, and returns a table of contour areas with fields for: Geom, ValueMin, and ValueMax.

 

The set of heights does not have to be sorted and may contain duplicates, which will be ignored. For N unique heights, the returned table contains N+1 records: the area below the smallest height, N-1 areas between subsequent heights, and the  area above the biggest height.

 

Some of the geoms in the returned table might be NULL values. The returned areas cover the entire image.  The <split> argument is true or false: when true, the result is decomposed into multiple objects when a single object would exceed 64 million coordinates.

TileContourAreasPar(<image>, <channel>, <heights>, <split>, <config>)

A parallel form of the TileContourAreas function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileContourAreas function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

 

Example: create a set of contours for the given heights using all available threads:

 

TABLE CALL TileContourAreasPar([german_alps], 0,

  (VALUES (500), (1000), (1500), (3500)), -- heights

  true, ThreadConfig(SystemCpuCount()));

 

Example: create a set of contours for the given heights using four threads:

 

TABLE CALL TileContourAreasPar([german_alps], 0,

  (VALUES (500), (1000), (1500), (3500)), -- heights

  true, ThreadConfig(4));

 

TileContourLine(<image>, <channel>, <height): <geom>

Takes a raster image with terrain heights in the specified channel, and a desired contour line height, and returns a single contour line for the specified height. If the specified height is lower or higher than any of the image pixels, the function returns a NULL value.

TileContourLinePar(<image>, <channel>, <height>, <config>): <geom>

A parallel form of the TileContourLine function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileContourLine function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileContourLines(<image>, <channel>, <heights>, <split>): <table>

Takes a raster image with terrain heights in the specified channel, and a set of desired contour heights specified as a table, and returns a table of contour lines with fields for:  Geom, and Value (height).

 

The set of heights does not have to be sorted and may contain duplicates, which will be ignored. The returned table contains a record for each unique height.

 

Some of the geoms in the returned table might be NULL values.  The <split> argument is true or false: when true, the result is decomposed into multiple objects when a single object would exceed 64 million coordinates.

TileContourLinesPar(<image>, <channel>, <heights>, <split>, <config>): <table>

A parallel form of the TileContourLines function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileContourLines function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileContrast(<tile>, <center>, <power>) : <tile>

Given a tile with single channel values, a center value and an exponent value adjust the contrast of the image.  Tones below the center value will be darkened exponentially and those above will be lightened exponentially using the power argument, to produce values for the returned tile that will give it altered contrast.

TileCos(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to  the input tile pixel values.

TileCosh(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to  the input tile pixel values.

TileCurvGaussian(<tile>, <radius>, <scalex3>) : <tile>

Given a tile value, a radius, and XYZ scales, computes Gaussian curvature.  Gaussian curvature indicates the overall curvature of a surface, if the surfce is positively curved like a dome, negatively curved like a cup, saddle-shaped or not curved. Gaussian curvature at any pixel is the geometric mean of the maximum and minimum curvatures that can be found in any given direction from that pixel. High values indicate more curvature along both maximum and minimum curvature directions. GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  See the Wolfram articles on Gaussian curvature and Curvature in general for mathematical details.

TileCurvMean(<tile>, <radius>, <scalex3>) : <tile>

Given a tile value, a radius, and XYZ scales, computes mean curvature.  The mean curvature at any pixel is the arithmetic mean of the maximum and minimum curvatures that can be found in any given direction from that pixel.  High values indicate more curvature along at least one of the maximum and minimum curvature directions.  GPU parallelism switches to CPU parallelism at a radius of 9 or greater.   See the Wolfram articles on mean curvature and Curvature in general for mathematical details.

TileCurvPlan(<tile>, <radius>, <scalex3>) : <tile>

Given a tile value, a radius, and XYZ scales, computes planform curvature. Plan curvature is the curvature of a surface perpendicular to the direction of maximum slope. GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  See the ESRI article.

TileCurvProfile(<tile>, <radius>, <scalex3>) : <tile>

Given a tile value, a radius, and XYZ scales, computes profile curvature. Profile curvature is the curvature of a surface parallel to the direction of maximum slope.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  See the ESRI article.

TileCut(<image>, <valuex2>) : <tile>

Given an image and X and Y values as an x2 vector, returns the tile at the specified X and Y location in the image.   

TileCutBorder(<image>, <valuex2>, <border>) : <tile>

Given an image,  X and Y values as an x2 vector, and a border size, returns the tile at the specified X and Y location in the image with the specified border.  The border size can be negative.  GPU parallelism switches to CPU parallelism at a border size of 9 pixels or more.  Calls to tile functions which use borders of 9 or more pixels automatically dispatch to CPU parallelism, and can freely intermix with calls dispatched to GPU parallelism.

TileCutRect(<image>, <valuex4>) : <tile>

Given an image and the two X,Y corners of a rectangle (Xmin, Ymin and Xmax, Ymax) in the image as an x4 vector, returns the tile at the specified rectangle in the image.

TileDistanceMake(<image>, <channel>, <barriers>): <distances>

Given a raster image, a channel to use in that image, and a boolean flag to use or not use  NULL pixels as barriers, returns a distance buffer computed using shortest Euclidean (straight line) distance that can be used in further calls.

TileDistanceMakePar(<image>, <channel>, <barriers>, <threads>): <distances>

A parallel form of the TileDistanceMake function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileDistanceMake function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileDistanceMakeSlope(<image>, <channel>, <slopeMin>, <slopeMax>, <weightMin>, <weightZero>, <weightMax>, <fromDrawing>): <distances>

Given a raster where each pixel value is a slope, a channel to use in that image, and using specified parameters, returns a distance buffer that can be used in further calls. Computed using path distances where pixel costs are generated from slope values based on slope values and the specified parameters, thus allowing paths going downhill to have lower costs.

 

<slopeMin>, <slopeMax> -  Minimum and maximum values for the allowed slopes.  Pixels with slopes equal to or lower than minimum, or equal to or higher than maximum are considered to not be traversable and will be avoided by paths.  Transform templates using this function use -90 and 90 as defaults for minimum and maximum slope values allowed.

 

<weightMin>, <weightZero>, <weightMax> - Costs for minimum slope, zero or flat slope, and maximum slope.  Transform templates using this function use 0, 1, and 2 as defaults for costs for minimum slope, zero slope, and maximum slope respectively.  The default values weight paths going downhill as having lower costs.

 

<fromDrawing> - A boolean flag to reverse path direction to reckon paths from points specified in a drawing used in subsequent steps, instead of toward drawing points.

TileDistanceMakeSlopePar(<image>, <channel>, <slopeMin>, <slopeMax>, <weightMin>, <weightZero>, <weightMax>, <fromDrawing>, <threads>): <distances>

A parallel form of the TileDistanceMakeSlope function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileDistanceMakeSlope function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileDistanceMakeWeighted(<image>, <channel>, <equal>): <distances>

Given a raster image, a channel to use in that image, and a boolean flag to use equal costs (weights), returns a distance buffer computed using shortest or lowest cost path distance that can be used in further calls.  An <equal> flag of TRUE uses equal costs for all pixels, computing shortest paths that avoid missing pixels.  An <equal> flag of FALSE uses values in valid pixels as distance / travel costs, computing lowest cost paths that avoid missing pixels.

TileDistanceMakeWeightedPar(<image>, <channel>, <equal>, <threads>): <distances>

A parallel form of the TileDistanceMakeWeighted function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileDistanceMakeWeighted function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileDistanceTilesClosest(<distances>, <drawing>, <field>): <table>

Given a distance buffer, a drawing with points, and a numeric field in that drawing to use for identification of each point,  returns a raster with the value of each pixel set to the identification field value of the closest point. If the name of the source field is a blank string, sequential numbers will be used to identify each point, starting from zero.

 

The table returned is an indexed table, to allow use in joins.

TileDistanceTilesClosestPar(<distances>, <drawing>, <field>, <threads>): <table>

A parallel form of the TileDistanceTilesClosest function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileDistanceTilesClosest function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileDistanceTilesDirection(<distances>, <drawing>, <type>): <table>

Given a distance buffer, a drawing with points, and a direction type, returns a raster with the value of each pixel set to the direction of the shortest path from the pixel to the closest point. Direction types:

 

0 - Direction to the closest point, in degrees between 0 and 360, Euclidean distances only, the default.

1 - Direction to the next pixel on the shortest path to the closest point, in degrees The direction from each pixel to an adjacent pixel can be only one of eight possible directions, 45, 90, 135, 180, 225, 270, or 315, or 360 degrees,  since adjacent pixels can only be to the left or right, above or below, or at one of four diagonal directions in between.  Direction values will be restricted to those eight values, plus 0 for the pixel coincident with the nearest point. Path distances only.

2 - Direction to the next pixel on the shortest path to the closest point, a quadrant value between 0 and 7, and using -1 when the pixel is coincident with the closest point, path distances only.

3 - Direction to the next pixel on the shortest path to the closest point, a quadrant value between 1 and 8, and using 0 when the pixel is coincident with the closest point, path distances only.

TileDistanceTilesDirectionPar(<distances>, <drawing>, <type>, <threads>): <table>

A parallel form of the TileDistanceTilesDirection function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileDistanceTilesDirection function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileDistanceTilesLength(<distances>, <drawing>): <table>

Given a distance buffer, and a drawing with points, returns a raster with the value of each pixel set to the distance from the pixel to the closest point.

TileDistanceTilesLengthPar(<distances>, <drawing>, <threads>): <table>

A parallel form of the TileDistanceTilesLength function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileDistanceTilesLength function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileErf(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the error function (also called erf(z) ) of the input tile pixel values.

TileErfc(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the complementary error function (also called erfc(z) ) of the input tile pixel values.

TileExp(<tile>) : <tile>

The exponential function: Given a tile value returns a tile with pixel values set to e to the power of the input tile pixel values.  

TileExp10(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to 10 to the power of the input tile pixel values.

TileExp2(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to 2 to the power of the input tile pixel values.

TileExpm1(<tile>) : <tile>

Given a tile value with pixel values of x, returns a tile with pixel values set to e^x-1.

TileFill(<tile>, <value>) : <tile>

Given a tile value and a pixel value returns a tile with all pixel values set to the specified pixel value.  The function can accept xN values. TileFill keeps the original tile data type.  

TileFillBaseLevel(<image>): <table>

Given an image, returns a table (filling the image's table) with tiles for all image tiles within the image rect (rectangular extent), and adding NULL tiles for any missing records (tiles) in the image.

Consider an example using the small image above.

The table for the image has only four records, each record containing a tile.

We select two of the records and delete them.

The table now has only two records, and is missing two records that are required to fill in the image's rect (rectangular extent).

The image window updates with regions of the image where tiles are missing not being rendered.   The message warns us intermediate levels are now out of date.

 

We run the following SQL in the Command Window:

 

TABLE CALL TileFillBaseLevel([Bronze]);

 

Immediately two new records are added to the table, providing NULL values for the missing tiles.  The image is not complete, of course, but the table has records for all X,Y tile positions that are required to fill in the image's rect.

TileFillMissing(<tile>, <value>): <tile>

Given a tile value and a pixel value returns a tile with all missing pixel values set to the specified pixel value and makes them visible. The function can accept xN values. Keeps the original tile data type.

TileFillMissingCopy(<tile>, <tileBack>): <tile>

Given a tile and a background tile with the same tile sizes, returns a tile with pixels from the first tile where invisible pixels in the first tile have been replaced by corresponding pixels from the background tile.  Keeps the original tile data type. Does nothing if the tile sizes are not the same.

TileFillMissingNearest(<tile>, <radius>): <tile>

Given a tile value and a pixel value returns a tile with all missing pixel values set to the first found visible pixel value within the specified radius. The function can accept xN values. Keeps the original tile data type. 

TileFillSinks(<image>, <channel>, <deltaMin>, <flowMin>): <table>

Given an image, a specified channel, a <deltaMin> minimum difference in height (the fill height value), and a <flowMin> minimum flow (the fill flow value), returns an image with filled sinks, as follows:

  

  • If both deltaMin and flowMin are negative or zero, the image is left unchanged.

  • If deltaMin is positive and flowMin is negative or zero, sinks are filled based solely on height, equivalent to the depth of the sink.

  • If deltaMin is negative or zero and flowMin is positive, sinks are filled based solely on flow, equivalent to the area of the sink.  

  • If both deltaMin and flowMin are positive, sinks are filled based on both height and flow.

 

The table returned is an indexed table, to allow use in joins.

 

See illustrations and examples in the Watershed Prepare: Filling Sinks  topic.

TileFillSinksPar(<image>, <channel>, <deltaMin>, <flowMin>, <config>): <table>

A parallel form of the TileFillSinks function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileFillSinks function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileFilter(<tile>, <radius>, <filter>): <tile>

Takes an input tile, a radius and a tile with filter coefficients, and performs a linear filter. This is a generalization of TileFilterDefGaussian and similar functions, which imply specific ways to create the filter tile.  The function produces missing pixels if the filter shape covers no valid pixels.  GPU parallelism switches to CPU parallelism at a radius of 9 or greater.

TileFilterCount(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, counts the number of non-NULL pixel values with non-zero weights in the filter.   The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.

TileFilterDefCircle(<radius>, <center>): <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.    Applies a circle-shaped linear filter of specified radius.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value compared to other pixels in the array.  

TileFilterDefCross(<radius>, <center>) : <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.    Applies a cross-shaped linear filter of specified radius.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value compared to other pixels in the array.  

TileFilterDefDiamond(<radius>, <center>: <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.    Applies a diamond-shaped (mid-way between cross and circle) linear filter of specified radius.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value compared to other pixels in the array.  

TileFilterDefDirection(<radius>, <center>, <angle>) : <tile>

Given a radius, center and angle in radians, produce a filter definition matrix to pass to TileFilter.  Produces a blur effect in the direction specified.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value in averaging compared to other pixels in the array.  

TileFilterDefEdges(<radius>, <center>) : <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.    Detects edges in an image using a Laplacian of Gaussian filter shape, normed to the center value.   The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value compared to other pixels in the array. 

TileFilterDefEdgesDirection(<radius>, <center>, <angle>) : <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.   Detects edges in an image using a Laplacian of Gaussian filter shape, normed to the center value.   The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value compared to other pixels in the array. 

TileFilterDefGaussian(<radius>, <center>) : <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.   Produces a blur effect using an algorithm that corrects for circular radius and using a decaying exponent in the filter shape.   The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value in averaging compared to other pixels in the array. 

TileFilterDefSharpen(<radius>, <center>) : <tile>

Given a radius and center, produce a filter definition matrix to pass to TileFilter.  Sharpens an image by convolution with a moving, square matrix to detect changes in pixel values that indicate transitions in visual appearance,  returning a tile where transitions have been enhanced with greater contrast.   The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value compared to other pixels in the array.

TileFilterDefSquare(<radius>, <center>) : <tile>

Given the radius and center, produce a filter definition matrix to pass to TileFilter.  Produces a blur effect.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array. The <center> argument is the weight to give the center pixel: a weight of 1 means not to emphasize it.  A weight of 5 means to give the center pixel's value five times the value in averaging compared to other pixels in the array. 

TileFilterDiversity(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates diversity using pixel values with non-zero weights in the filter.  Diversity is the total number of different values.  The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  

TileFilterDiversityIndex(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates the  diversity index using pixel values with non-zero weights in the filter.   A diversity index provides a measure of diversity, computed as 1 - sum(individualcount^2) / (totalcount^2).  A diversity index of 0 means that all values are equal.  The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater. 

TileFilterMajor(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, determines the most frequently occurring value of pixel values with non-zero weights in the filter.  The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.

TileFilterMax(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, determines the maximum value of pixel values with non-zero weights in the filter.  The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater. 

TileFilterMedian(<tile>, <radius>, <filter>) : <tile>

Given an  input tile, a radius and a tile with filter coefficients, performs a median filter.  Pixels with non-zero filter coefficients participate in computing the median, whereas pixels with zero filter coefficients and invisible pixels do not. The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  

TileFilterMin(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, determines the minimum value of pixel values with non-zero weights in the filter.  The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater. 

TileFilterStDev(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates the standard deviation using pixel values with non-zero weights in the filter.   The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.

TileFilterStDevPop(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates the square root of the population variance using pixel values with non-zero weights in the filter.   The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.

TileFilterSum(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates the sum of pixel values with non-zero weights in the filter.  The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.  The function produces missing pixels if the filter shape covers no valid pixels.  GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  

TileFilterVar(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates the sample variance using pixel values with non-zero weights in the filter.   The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater. 

TileFilterVarPop(<tile>, <radius>, <filter>): <tile>

Given an  input tile, a radius and a tile with filter coefficients, calculates the population variance using pixel values with non-zero weights in the filter.   The number of non-zero coefficients must be 32 or less.  The <radius> argument sets the number of pixels from the center pixel to the edge:  A radius of 1 results in a 3x3 pixel array.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.   

TileFloor(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the rounded down integer value of the input tile pixel values.   See the note below on the difference between Floor and Trunc functions. 

TileFloorDecs(<tile>, <decimals>) : <tile>

Given a tile value and the desired number of decimals returns a tile with pixel values set to the integer value rounded down to the specified number of decimals of the input tile pixel values.    See the note below on the difference between Floor and Trunc functions.  

TileFlowDirAccum(<image>, <channel>): <table>

Takes an image, and using the specified channel returns computed flow direction and accumulation as a dual image, using a table with fields for X, Y, FlowDir, and FlowAccum. Flow direction is returned as an INT8 data type, where, 0 corresponds to 'up', and 1-2-3-4-5-6-7 proceed clockwise. Flow accumulation is returned as a FLOAT64 data type.  See illustrations and examples in the Flow Direction and Accumulation topic.

TileFlowDirAccumPar(<image>, <channel>, <config>): <table>

A parallel form of the TileFlowDirAccum function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileFlowDirAccum function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileFract(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the decimal fractional part of the input tile pixel values. 

TileFractDecs(<tile>, <decimals>) : <tile>

Given a tile value and the desired number of decimals returns a tile with pixel values set to the decimal fractional part to the specified number of decimals of the input tile pixel values. 

TileGeom functions

For examples of TileGeom functions listed immediately below, see the Example: Transfer DEM Terrain Heights to Areas in a Drawing topic.

 

See also the Notes section at the end of this topic.

TileGeomAvg(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>,  and a geom in a drawing, return the average value found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomCount(<image>, <geom>): <value>

Given a single-channel image and a geom in a drawing, return the number of pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomDiversity(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the total number of different values found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomDiversityIndex(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the diversity index for the pixels that are located within the geom.  A diversity index provides a measure of diversity, computed as 1 - sum(individualcount^2) / (totalcount^2).  A diversity index of 0 means that all values are equal.  The image and the drawing must be in the same coordinate system.  

TileGeomMajor(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the most frequently occurring value found in pixels that are located within the geom.  If all values are different, the function returns the lowest value. The image and the drawing must be in the same coordinate system.

TileGeomMax(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the maximum value found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.  

TileGeomMedian(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the median value found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomMin(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the minimum value found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.  

TileGeomOverlayCount(<image>, <drawing>, <field>): <table>

 

TileGeomOverlayCountPar(<image>, <drawing>, <field>, <threads>): <table>

Given an image, a drawing, and a numeric field name in the drawing, produce an image with the same parameters as the specified image, but with each pixel in that image filled with the count of objects in the drawing that overlay that pixel.   

 

The parallel variant, TileGeomOverlayCountPar, takes an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.    If the number of threads is less than or equal to 1 the TileGeomOverlayCount function will be executed.  

TileGeomOverlayMax(<image>, <drawing>, <field>): <table>

 

TileGeomOverlayMaxPar(<image>, <drawing>, <field>, <threads>): <table>

Given an image, a drawing, and a numeric field name in the drawing, produce an image with the same parameters as the specified image, but with each pixel in that image filled with the maximum value in the specified numeric field found within all objects in the drawing that overlay that pixel.   

 

The parallel variant, TileGeomOverlayMaxPar, takes an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.    If the number of threads is less than or equal to 1 the TileGeomOverlayMax function will be executed.  

TileGeomOverlayMin(<image>, <drawing>, <field>): <table>

 

TileGeomOverlayMinPar(<image>, <drawing>, <field>, <threads>): <table>

Given an image, a drawing, and a numeric field name in the drawing, produce an image with the same parameters as the specified image, but with each pixel in that image filled with the minimum value in the specified numeric field found within all objects in the drawing that overlay that pixel.   

 

The parallel variant, TileGeomOverlayMinPar, takes an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.    If the number of threads is less than or equal to 1 the TileGeomOverlayMin function will be executed.  

TileGeomOverlaySum(<image>, <drawing>, <field>): <table>

 

TileGeomOverlaySumPar(<image>, <drawing>, <field>, <threads>): <table>

Given an image, a drawing, and a numeric field name in the drawing, produce an image with the same parameters as the specified image, but with each pixel in that image filled with the sum of values in the specified numeric field found within all objects in the drawing that overlay that pixel.   

 

The parallel variant, TileGeomOverlaySumPar, takes an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.   If the number of threads is less than or equal to 1 the TileGeomOverlaySum function will be executed.  

TileGeomStDev(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the standard deviation of values found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomStDevPop(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the square root of population variance of values found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomSample(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return one sample pixel value found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.  This function is the fastest way to capture data for a geom from an image.

TileGeomSum(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the sum of values found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomToValues(<image>, <geom>): <table>

Given a single-channel image and a geom in a drawing, returns a table with all pixels located within the geom, with X, Y, and Value fields in the table.  The image and the drawing must be in the same coordinate system.

TileGeomToValuesX2<image>, <geom>): <table>

Given a two-channel image and a geom in a drawing, returns a table with all pixels located within the geom, with X, Y, and Value (as an x2 data type)  fields in the table.  The image and the drawing must be in the same coordinate system.

TileGeomToValuesX3(<image>, <geom>): <table>

Given a three-channel image and a geom in a drawing, returns a table with all pixels located within the geom, with X, Y, and Value (as an x3 data type)  fields in the table.  The image and the drawing must be in the same coordinate system.

TileGeomToValuesX4(<image>, <geom>): <table>

Given a four-channel image and a geom in a drawing, returns a table with all pixels located within the geom, with X, Y, and Value (as an x4 data type)  fields in the table.  The image and the drawing must be in the same coordinate system.

TileGeomVar(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the sample variance of values found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileGeomVarPop(<image>, <channel>, <geom>): <value>

Given a single-channel image or a multi-channel image using the specified <channel>, and a geom in a drawing, return the population variance of values found in pixels that are located within the geom.  The image and the drawing must be in the same coordinate system.

TileHcyBgr(<tilehcy>) : <tilebgr>

Given a tile value with pixels in HCY color space returns a tile with pixel values in BGR color space.

TileHsiBgr(<tilehsi>) : <tilebgr>

Given a tile value with pixels in HSI color space returns a tile with pixel values in BGR color space.

TileHslBgr(<tilehsl>) : <tilebgr>

Given a tile value with pixels in HSL color space returns a tile with pixel values in BGR color space.

TileHsvBgr(<tilehsv>) : <tilebgr>

Given a tile value with pixels in HSV color space returns a tile with pixel values in BGR color space.

TileHypot(<x>, <y>) : <tile>

The great and ancient Pythagorean theorem: The square root of the sum of the squares of the two sides of a right triangle.   Given two tile values or a tile value and a number, returns a tile with pixel values set to  the hypotenuse taking two input values  as DX and DY.

TileInterpolate(<interpolation>, <valuex4>) : <tile>

Takes a <valuex4> rectangle and an <interpolation> object created by one of the TileInterpolateKriging or TileInterpolateTriangulation functions, and creates a tile with interpolated pixel values.  See the SQL Example: Kriging topic.

TileInterpolateGravity(<drawing>, <fieldZ>, <radius>, <neighbors>, <order>, <boundsx4>, <scalex2>) : <interpolation>

Takes a drawing and interpolation parameters and uses gravity formulae  with inverse distance weighting (IDW) to return an interpolation object that can be used to produce tiles.

 

Heights are taken from Z values in the specified field or in drawing geoms. Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <radius> - Radius for neighbor searches (Kriging interpolates heights from closest coordinates),

  • <neighbors> - Number of neighbors to use.

  • <order> - The interpolation order, any positive number and possibly fractional, with a value of 2 using quadratic terms being a good choice.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

Interpreting various combinations of specified (positive value) or auto-computed (zero or negative value) for <radius> and <neighbors>:

 

  • Specified Radius and Neighbors auto-computed = Use all neighbors within the specified radius.

  • Both Radius and Neighbors auto-computed = Use all Voronoi neighbors.  

  • Specified number of Neighbors, but Radius auto-computed = Radius set by the system according to the global interpolation picture.

  • Specified number of Neighbors, and specified Radius = Use up to the specified number of neighbors within the specified radius.

 

See the SQL Example: Kriging topic.

TileInterpolateGravityPar(<drawing>, <fieldZ>, <radius>, <neighbors>, <order>, <boundsx4>, <scalex2>, <config>): <interpolation>

A parallel variant of TileInterpolateGravity, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.

TileInterpolateKriging(<<drawing>, <fieldZ>, <radius>, <neighbors>, <model>, <boundsx4>, <scalex2>) : <interpolation>

Takes a drawing and interpolation parameters and uses Kriging to return an interpolation object that can be used to produce tiles.

 

Heights are taken from Z values in the specified field or in drawing geoms.  Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.     If there is too little data to set up the model, Kriging degrades to Gravity interpolation.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <radius> - Radius for neighbor searches (Kriging interpolates heights from closest coordinates),

  • <neighbors> - Number of neighbors to use

  • <model> - Interpolation model.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance, particularly for various types of Kriging which otherwise would spend significant time computing values near the edges.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

Interpolation model codes:

 

  • zero or negative value = autoselect the model

  • 1 = linear model

  • 2 = circular model

  • 3 = exponential model

  • 4 = Gaussian model

  • 5 = power model

  • 6 = rational model

  • 7 = spherical model

 

Interpreting various combinations of specified (positive value) or auto-computed (zero or negative value) for <radius> and <neighbors>:

 

  • Specified Radius and Neighbors auto-computed = Use all neighbors within the specified radius.

  • Both Radius and Neighbors auto-computed = Use all Voronoi neighbors.  

  • Specified number of Neighbors, but Radius auto-computed = Radius set by the system according to the global interpolation picture.

  • Specified number of Neighbors, and specified Radius = Use up to the specified number of neighbors within the specified radius.

 

See the SQL Example: Kriging topic.

TileInterpolateKrigingPar(<drawing>, <fieldZ>, <radius>, <neighbors>, <model>, <boundsx4>, <scalex2>, <config>) : <interpolation>

A parallel variant of TileInterpolateKriging, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  See the SQL Example: Kriging topic.

TileInterpolateKrigingMedianPolish(<drawing>, <fieldZ>, <radius>, <step>, <neighbors>, <model>, <boundsx4>, <scalex2>) : <interpolation>

Takes the same parameters as TileInterpolateKriging and returns an interpolation object that can be used to produce tiles using Kriging with median-polish, that is, additional processing intended to improve interpolation quality.  The <step> argument sets the size of the step for each application of median polish algorithm.   0 or negative step  = use automatic step value.  See the SQL Example: Kriging topic.

TileInterpolateKrigingMedianPolishPar(<drawing>, <fieldZ>, <radius>, <step>, <neighbors>, <model>, <boundsx4>, <scalex2>, <config>) : <interpolation>

A parallel variant of TileInterpolateKrigingMedianPolish, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  The <step> argument sets the size of the step for each application of median polish algorithm.   0 or negative step  = use automatic step value.  See the SQL Example: Kriging topic.

TileInterpolateKrigingRegression(<drawing>, <fieldZ>, <radius>, <step>, <neighbors>, <model>, <regression>, <boundsx4>, <scalex2>) : <interpolation>

Takes a drawing and interpolation parameters and uses Kriging to return an interpolation object that can be used to produce tiles.

 

Heights are taken from Z values in the specified field or in drawing geoms.  Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.   If there is too little data to set up the model, Kriging degrades to Gravity interpolation.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <radius> - Radius for neighbor searches (Kriging interpolates heights from closest coordinates),

  • <neighbors> - Number of neighbors to use

  • <model> - Interpolation model.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance, particularly for various types of Kriging which otherwise would spend significant time computing values near the edges.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

Interpolation model codes:

 

  • zero or negative value = autoselect the model

  • 1 = linear model

  • 2 = circular model

  • 3 = exponential model

  • 4 = Gaussian model

  • 5 = power model

  • 6 = rational model

  • 7 = spherical model

 

Regression model codes:

 

  • zero or negative value = autoselect the model

  • 1 = linear model

  • 2 = quadratic model

 

Interpreting various combinations of specified (positive value) or auto-computed (zero or negative value) for <radius> and <neighbors>:

 

  • Specified Radius and Neighbors auto-computed = Use all neighbors within the specified radius.

  • Both Radius and Neighbors auto-computed = Use all Voronoi neighbors.  

  • Specified number of Neighbors, but Radius auto-computed = Radius set by the system according to the global interpolation picture.

  • Specified number of Neighbors, and specified Radius = Use up to the specified number of neighbors within the specified radius.

 

About regression Kriging: Imagine an undulating surface that lies on the slope of a large hill, where if the surface were not bumpy we would have a smooth plane inclined at the overall angle of the hill.  Suppose now we have many points that lie on the surface with each point providing the X,Y, and Z value of the surface at that point. Some regions of the surface have relatively few points or are lacking points.  

 

The general task of Kriging is to take the collection of many points and to re-create the surface, filling in through computation some plausible interpolation in regions where sample points are sparse or missing.  Ordinary Kriging simply takes the X,Y,Z values of the points and applies Kriging computations to interpolate a surface.

 

Regression Kriging first attempts to ascertain the overall inclined plane and to remove that as a bias, to allow considering the undulating surface as if it were arranged horizontally and not tilted on the overall slope of a hill.  A Kriging calculation is performed on the adjusted, "as if level,"  coordinates of the points, and then the resulting interpolated surface is titled back to the original overall incline.  The choice of linear or quadratic regression is a choice of how the original "overall" tilted-plane setting is determined.

 

Regression Kriging can identify and set aside more complex biases than the case of an undulating surface within a simple, overall incline in a hill.  This non-mathematical description provides an analogy, not an exact phrasing of the math involved, to help non-mathematicians understand how Regression Kriging can provide better results than ordinary Kriging.

TileInterpolateKrigingRegressionPar(<drawing>, <radius>, <neighbors>, <model>, <regression>, <boundsx4>, <scalex2> <config>) : <interpolation>

A parallel variant of TileInterpolateKrigingRegression, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  

TileInterpolateNatural(<drawing>, <fieldZ>, <boundsx4>, <scalex2>): <interpolation>

Takes a drawing and interpolation parameters and uses natural neighbors interpolation with Sibson weights to return an interpolation object that can be used to produce tiles.

 

Heights are taken from Z values in the specified field or in drawing geoms. Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

See the SQL Example: Kriging topic.

TileInterpolateNaturalPar(<drawing>, <fieldZ>, <boundsx4>, <scalex2>, <config>): <interpolation>

A parallel variant of TileInterpolateNatural, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  

TileInterpolateSpline(<drawing>, <fieldZ>, <radius>, <neighbors>, <boundsx4>, <scalex2>): <interpolation>

Takes a drawing and interpolation parameters and uses thin-plate spline (TPS) to return an interpolation object that can be used to produce tiles.

 

Heights are taken from Z values in the specified field or in drawing geoms. Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <radius> - Radius for neighbor searches.

  • <neighbors> - Number of neighbors to use.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

Interpreting various combinations of specified (positive value) or auto-computed (zero or negative value) for <radius> and <neighbors>:

 

  • Specified Radius and Neighbors auto-computed = Use all neighbors within the specified radius.

  • Both Radius and Neighbors auto-computed = Use all Voronoi neighbors.  

  • Specified number of Neighbors, but Radius auto-computed = Radius set by the system according to the global interpolation picture.

  • Specified number of Neighbors, and specified Radius = Use up to the specified number of neighbors within the specified radius.

 

See the SQL Example: Kriging topic.

TileInterpolateSplinePar(<drawing>, <fieldZ>, <radius>, <neighbors>, <boundsx4>, <scalex2>, <config>): <interpolation>

A parallel variant of TileInterpolateSpline, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  

TileInterpolateTriangulation(<drawing>, <fieldZ>, <boundsx4>, <scalex2>) : <interpolation>

Takes a drawing and returns an interpolation object that can be used to produce tiles using triangulation. As with Kriging, all geoms are currently converted to coordinates. This will be changed to use constrained triangulation for lines and either convert areas to boundaries or ignore them.  

 

Heights are taken from Z values in the specified field or in drawing geoms.  Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

TileInterpolateTriangulationPar(<drawing>, <fieldZ>, <boundsx4>, <scalex2>, <config>) : <interpolation>

A parallel variant of TileInterpolateTriangulation, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  

TileInterpolateTriangulationSeg(<drawing>, <fieldZ>, <dest>, <boundsx4>, <scalex2>) : <interpolation>

Takes a drawing and returns an interpolation object that can be used to produce tiles using constrained triangulation.  The constrained triangulation keeps segments from lines and areas, which are converted to boundary lines.

 

Heights are taken from Z values in the specified field or in drawing geoms.  Geoms without Z values are ignored. All geoms are converted to coordinates. Duplicate XY coordinates are ignored: if duplicate XY coordinates have different Z values, the function uses one of these values and ignores any other Z values.

 

Interpolation parameters:

 

  • <fieldZ> - Field containing Z values.  If the name of the Z field is a blank string, the function will use Z data stored in the drawing geoms.

  • <dest> - a boolean parameter that provides an option to improve triangulation of contours using DEST (true = use DEST).  The DEST (Determination of Earth Surface Structures) algorithm helps to remove or reduce terracing effects when contouring from contour lines or other regular data.

  • <boundsx4> - X,Y corners of the desired destination image rectangle (Xmin, Ymin and Xmax, Ymax) as an x4 vector.  Passing invalid bounds, for example, VectorMakeX4(1, 1, 0, 0), sets bounds to those of the source data. Specifying bounds allows the algorithm to avoid computing values that will be ignored later anyway, and improves performance.

  • <scalex2> - XY scales to use for the produced pixels, expressed in degrees or meters depending on the coordinate system of the image. The XY shifts are assumed to be 0.

 

TileInterpolateTriangulationSegPar(<drawing>, <fieldZ>, <dest>, <boundsx4>, <scalex2>, <config>) : <interpolation>

A parallel variant of TileInterpolateTriangulationSeg, taking an additional parameter with the thread configuration.   Use ThreadConfig to generate a JSON string with the desired number of threads.  

TileJ0(<tile>) : <tile>

A Bessel function of the first kind: Given a tile value returns a tile with pixel values set to the result of the Bessel function J0(x) using the input tile pixel values.  

TileJ1(<tile>) : <tile>

A Bessel function of the first kind: Given a tile value returns a tile with pixel values set to the result of the Bessel function J1(x) using the input tile pixel values.  

TileJn(<order>, <tile>) : <tile>

The nth Bessel function of the first kind: Given an order and a tile value returns a tile with pixel values set to the result of the Bessel function Jn(x) for order n using the input tile pixel values.  

TileJson(<tile>): <json>

Takes a tile and prints it into a JSON text string: [ p1, p2, p3, ... ]. Pixels are ordered by Y and then by X, with row 0 being first. There are no extra separators between rows. If there are multiple channels, each pixel is printed as the value of channel 0, then the value of channel 1, etc., as in [ ... c0, c1, c2, ... ]. Invisible pixels are printed as 'null' (an allowed keyword in JSON). If there are multiple channels, invisible pixels are printed as a sequence of 'null' values for each channel.

TileLgamma(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the log-gamma function, taking the natural logarithm of the gamma function, for the input tile pixel values.

TileLog(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the base e logarithm (also called the natural logarithm) of the input tile pixel values.

TileLog10(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the base 10 logarithm (also called the common logarithm) of the input tile pixel values.

TileLog1p(<tile>) : <tile>

Given a tile value with pixel values x, returns a tile with pixel values set to Log(x+1) where Log is the base e logarithm (also called the natural logarithm) of the value.

TileLog2(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the base 2 logarithm (also called the binary logarithm) of the input tile pixel values.

TileMake(<cx>, <cy>, <value>) : <tile>

Given cx and xy extents and a value (a number, an xN vector or a boolean) returns a new tile. If the requested tile size is too large, the function returns NULL.

TileMask(<tile>) : <mask>

Takes an arbitrary tile and creates a tile of numeric values, with 1 for visible pixels and 0 for invisible pixels.

TileMaskRange(<tile>, <boundMin>, <boundMax>, <inclusive>, <keepRange>) : <tile>

Takes a single channel tile and returns a float64 tile that marks pixels with values inside or outside of the range as missing pixels. Boundary values can be included or excluded.   

 

  • <tile> - Source tile.
  • <boundMin> - Lower value of the pixel value range.
  • <boundMax> - Upper value of the pixel value range.
  • <inclusive> -  A Boolean flag: If TRUE include the boundMin and boundMax values in the range.  If FALSE exclude the boundMin and boundMax values from the range.
  • <keepRange> - A Boolean flag: If TRUE, pixel values within the cited range are kept as is and are not modified, with only pixel values outside the range marked as missing pixels.  If FALSE, pixel values within the range are marked as missing pixels and pixel values outside the range are kept as is.

 

For a tile using the same data type as the source tile, use the CASTV operator to cast the resulting tiles into the desired data type, for example,

 

CASTV(TileMaskRange([Tile], 1, 255, TRUE, TRUE) AS UINT8)

 

See the Example: TileMaskRange Expressions topic for examples using the <inclusive> and <keepRange> parameters.

 

TileMaskReplace(<tile>, <mask>) : <tile>

Takes an image tile and a mask tile of numeric values, and makes the pixels in the first tile visible or invisible according to the corresponding numeric values in the mask tile.   Values of 0 in the mask tile or a missing mask (as in cases where the mask tile does not overlap with some pixels in the image tile) will set the corresponding pixel in the image tile to invisible.  All other values in the mask tile will set the corresponding pixel in the image to visible.    Pixels that were previously invisible but are set to visible will have their values set to 0.

TileMax(<p>, <q>) : <tile>

Takes a tile and a value and returns the greater (maximum) value of the two for each pixel position.  

 

For example,  TileMax([Tile], -10) compares the value in the tile for each pixel to -10 and chooses which is the greater.  Used in a Transform pane Expression that would have the effect of setting all pixel values less than -10 to -10.  

 

For example, if a tile consists of a single channel with values from 0 to 255 in each pixel, then TileMax([Tile], 150) will return a tile where each pixel has the value of the corresponding pixel in [Tile] except that if that value is less than 150 then the pixel will have a value of 150.

 

The value could be another tile, so that TileMax([Tile1], [Tile2]) for each pixel returns whichever is the greater value of Tile1 or Tile2.

TileMin(<p>, <q>) : <tile>

Takes a tile and a value and returns the lesser (minimum) value of the two for each pixel position.  

 

For example,  TileMin([Tile], -10) compares the value in the tile for each pixel to -10 and chooses which is the lesser.  Used in a Transform pane Expression that would have the effect of setting all pixel values greater than -10 to -10.  

 

For example, if a tile consists of a single channel with values from 0 to 255 in each pixel, then TileMin([Tile], 150) will return a tile where each pixel has the value of the corresponding pixel in [Tile] except that if that value is more than 150 then the pixel will have a value of 150.

 

The value could be another tile, so that TileMin([Tile1], [Tile2]) for each pixel returns whichever is the lesser value of Tile1 or Tile2.

TileNoise(<tile>, <range>) : <tile>

Given a tile value and a range number, returns a tile with pixel values containing random noise values over the given range.

TilePow(<base>, <power>) : <tile>

Given a tile value returns a tile with pixel values set to the base (could be a tile or a numeric value) raised to the specified power value.   For example,  A power of 2 is the base value squared while a power of 3 is the base value cubed.  

TileRcbrt(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to reciprocal cube root of the input tile pixel values.   The reciprocal cube root is also known as the inverse cube root:  1 divided by the cube root of the input.

TileRemoveBorder(<tile>, <border>): <tile>

Removes a border region of pixels of the given size from a tile. If the border size is too big for the passed tile, returns NULL. If the border size is negative or zero, returns an unmodified tile.   GPU parallelism switches to CPU parallelism at a border size of 9 pixels or more.  Calls to tile functions which use borders of 9 or more pixels automatically dispatch to CPU parallelism, and can freely intermix with calls dispatched to GPU parallelism.

TileRound(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the fractional part rounded up or down to the nearest integer of the input tile pixel values.

TileRoundDecs(<tile>, <decimals>) : <tile>

Given a tile value returns a tile with pixel values set to the fractional part, rounded up or down to the number of decimals specified, of the input tile pixel values.

TileRsqrt(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to reciprocal square root of the input tile pixel values.   The reciprocal cube root is also known as the inverse square root:  1 divided by the square root of the input.

TileSign(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to 1 or -1 when the input tile pixel values are positive or negative, respectively.

TileSin(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the sine of the input tile pixel values.

TileSinh(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the hyperbolic sine of the input tile pixel values.

TileSize(<tile>): <sizex2>

Returns the dimensions of the tile as an x2 value.

TileSlope(<tile>, <radius>, <scalex3>) : <tile>

Given a tile value, a radius, and XYZ scales, returns a tile with pixel values set to the slope in degrees of the surface implied by treating input tile pixel values as heights.   GPU parallelism switches to CPU parallelism at a radius of 9 or greater.  

TileSqrt(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the square root of the input tile pixel values.

TileTan(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the tangent of the input tile pixel values.

TileTanh(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the hyperbolic tangent of the input tile pixel values.

TileTgamma(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the gamma function of the input tile pixel values.

TileToValues(<tile>, <withMissing>) : <table>

Given a tile returns a table where each row is a pixel with fields x, y, and value. The returned value field is used for numbers or booleans.   The <withMissing> argument is a boolean: a value of TRUE includes missing pixels in the output.  A value of FALSE excludes missing pixels from the output.

 

Using TileToValues together with aggregates provides a more general way of getting average, count, max, min and sums for tiles than providing a specific function for each such operation.

TileToValuesX2(<tile>, <withMissing>) : <table>

A variation of TileToValues for tiles containing x2 vector values.   Given a tile returns a table where each row is a pixel with fields x, y, value, the value field being a float64x2 vector.

TileToValuesX3(<tile>, <withMissing>) : <table>

A variation of TileToValues for tiles containing x3 vector values.   Given a tile returns a table where each row is a pixel with fields x, y, value, the value field being a float64x3 vector.

TileToValuesX4(<tile>, <withMissing>) : <table>

A variation of TileToValues for tiles containing x4 vector values.   Given a tile returns a table where each row is a pixel with fields x, y, value, the value field being a float64x4 vector.

TileTraceArea(<image>, <value>, <quant>): <geom>

Takes an image, a value to trace and a quantization factor, and returns a single area covering pixels with the specified value.

 

If the image contains more than one channel, the trace value must be an xN value of the appropriate size. The quantization factor remains a single numeric value that is applied to all channels simultaneously.

 

The quantization factor is used to extend the area to pixels with values close to the traced value. If the quantization factor is negative or zero, any differences in pixel values are considered significant and the returned area covers pixels with values exactly coinciding with the traced value.

 

If the quantization factor is positive, pixel values are quantized using the following formula:

 

pixelNew = floor(pixel / quant) * quant

 

Pixels that quantize to the same value are considered to be the same and the returned area covers them all.

 

For example, using a quant size of 100, pixel values between 0 and 99.9... are considered to be the same, pixel values between 100 and 199.9... are considered to be the same,  and so on.

 

See the Example: Trace Vector Areas from Raster Pixels topic for a transform template based example.

TileTraceAreaPar(<image>, <value>, <quant>, <config>): <geom>

A parallel form of the TileTraceArea function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileTraceArea function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileTraceAreas(<image>, <quant>, <decompose>) : <table>

Similar to TileTraceArea but creates multiple areas from a 1-channel image.   Takes a 1-channel image and a quantization factor, and returns a table of areas covering pixels with different values with fields for Geom and Value, with Value being a FLOAT64.    The decompose argument is true or false: when true, the result is decomposed into multiple objects when a single object would exceed 64 million coordinates.

TileTraceAreasPar(<image>, <quant>, <decompose>, <config>) : <table>

A parallel form of the TileTraceAreas function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileTraceAreas function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileTraceAreasX2(<image>, <quant>, <decompose>) : <table>

Similar to TileTraceArea but creates multiple areas from a 2-channel image.   Takes a 2-channel image and a quantization factor, and returns a table of areas covering pixels with different values with fields for Geom and Value, with Value being a FLOAT64x2.      The decompose argument is true or false: when true, the result is decomposed into multiple objects when a single object would exceed 64 million coordinates.

TileTraceAreasX2Par(<image>, <quant>, <decompose>, <config>) : <table>

A parallel form of the TileTraceAreasX2 function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileTraceAreasX2 function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileTraceAreasX3(<image>, <quant>, <decompose>) : <table>

Similar to TileTraceArea but creates multiple areas from a 3-channel image.   Takes a 3-channel image and a quantization factor, and returns a table of areas covering pixels with different values with fields for Geom and Value, with Value being a FLOAT64x3.      The decompose argument is true or false: when true, the result is decomposed into multiple objects when a single object would exceed 64 million coordinates.

TileTraceAreasX3Par(<image>, <quant>, <decompose>, <config>) : <table>

A parallel form of the TileTraceAreasX3 function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileTraceAreasX3 function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileTraceAreasX4(<image>, <quant>, <decompose>) : <table>

Similar to TileTraceArea but creates multiple areas from a 4-channel image.   Takes a 4-channel image and a quantization factor, and returns a table of areas covering pixels with different values with fields for Geom and Value, with Value being a FLOAT64x4.      The decompose argument is true or false: when true, the result is decomposed into multiple objects when a single object would exceed 64 million coordinates.

TileTraceAreasX4Par(<image>, <quant>, <decompose>, <config>) : <table>

A parallel form of the TileTraceAreasX4 function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileTraceAreasX4 function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileTrunc(<tile>) : <tile>

Given a tile value returns a tile with pixel values set to the truncated integer value of the input tile pixel values.     See the note below on the difference between Floor and Trunc functions.

TileTruncDecs(<tile>, <decimals>) : <tile>

Given a tile value and a number of decimal positions returns a tile with pixel values set to the truncated value, to the specified number of decimals, of the input tile pixel values.    See the note below on the difference between Floor and Trunc functions.

TileUpdateFieldPyramids(<component>, <field>): <table>

Updates pyramids (intermediate levels) for the specified tile field in the specified component, which could be the table for an image. If the tile field is not part of a spatial index, the call does nothing.

TileUpdatePyramids(<image>) : <table>

Updates pyramids  intermediate levels for an image.  The image must use an rtree index on x-y-tile fields.   Given an image the function updates intermediate levels and returns the number of update tiles.

TileUpdatePyramidsAll(<component>): <table>

Updates pyramids (intermediate levels) for all tile fields in the specified component, which could be the table for an image. If a  tile field is not part of a spatial index, the call does nothing for that tile field.

TileValueAvg(<tile>): <value>

Return the average value of all pixels in the tile.

TileValueCount(<tile>): <value>

Return the count of non-NULL values in the tile.

TileValueCountMissing(<tile>): <value>

Return the number of missing pixels in the tile.

TileValueMax(<tile>): <value>

Return the maximum pixel value in the tile.

TileValueMin(<tile>): <value>

Return the minimum pixel value in the tile.

TileValueStDev(<tile>): <value>

Return the standard deviation of pixel values in the tile.

TileValueStDevPop(<tile>): <value>

Return the square root of the population variance for pixel values in the tile.

TileValueSum(<tile>): <value>

Return the sum of pixel values in the tile.

TileValueVar(<tile>): <value>

Return the sample variance of pixel values in the tile.

TileValueVarPop(<tile>): <value>

Return the population variance of pixel values in the tile.

TileViewshedArea(<viewsheds>, <observerx3>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>): <geom>

Takes a viewshed buffer, the XYZ location of a single observer expressed as an x3 numeric vector, viewshed creation parameters, and returns an area visible from that single observer.

 

Viewshed creation parameters are: a <relativeZ> parameter that specifies whether the Z value for the observer is relative to heights in the image (true) or is an absolute height (false), the maximum visible radius (a negative value or zero means there is no limit), and minimum and maximum angles of the camera in degrees (-90 / 90 means that there are no limits).

TileViewshedAreaAll(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>): <geom>

 

Takes a viewshed buffer, a drawing with XY or XYZ points, viewshed creation parameters, and returns an area visible from all points in the drawing.

 

Viewshed creation parameters are: an optional field to use for Z values.  If the name of the Z field is a blank string, the function uses Z data stored in geometry values. When using a field for Z values, the <relativeZ> parameter specifies whether Z values for points in the drawing are relative to heights in the image (true) or are absolute heights (false), the maximum visible radius (a negative value or zero means there is no limit), and minimum and maximum angles of the camera in degrees (-90 / 90 means that there are no limits).

TileViewshedAreaAllPar(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>, <config>): <geom>

A parallel form of the TileViewshedAreaAll function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedAreaAll function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedAreaAny(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>): <geom>

 

Takes the same parameters as TileViewshedAreaAll and returns an area visible from any point in the drawing.

TileViewshedAreaAnyPar(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>, <config>): <geom>

A parallel form of the TileViewshedAreaAny function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedAreaAny function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedAreaPar(<viewsheds>, <observerx3>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>, <config>): <geom>

A parallel form of the TileViewshedArea function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedArea function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedMake(<image>, <channel>, <refraction>, <useDatumCurvature>): <viewsheds>

Takes an image, the channel to use in the image,  and global viewshed creation parameters, and returns a viewshed buffer. Global viewshed creation parameters are: a refraction coefficient (0 allowed), and an option to use datum curvature.

TileViewshedMakePar(<image>, <channel>, <refraction>, <useDatumCurvature>, <config>): <viewsheds>

A parallel form of the TileViewshedMake function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedMake function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedTilesCount(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>): <table>

Takes a viewshed buffer, a drawing with XYZ points, viewshed creation parameters, and returns a table with tiles with pixel values containing the number of points visible from the pixel.  The table will be indexed, to allow joins.

 

Viewshed creation parameters are: an optional field to use for Z values.  If the name of the Z field is a blank string, the function uses Z data stored in geometry values. When using a field for Z values, the <relativeZ> parameter specifies whether Z values for points in the drawing are relative to heights in the image (true) or are absolute heights (false), the maximum visible radius (a negative value or zero means there is no limit), and minimum and maximum angles of the camera in degrees (-90 / 90 means that there are no limits).

TileViewshedTilesCountPar(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>, <config>): <table>

A parallel form of the TileViewshedTilesCount function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedTilesCount function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedTilesLevelAll(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>): <table>

Takes a viewshed buffer, a drawing with XYZ points, viewshed creation parameters, and returns a table with tiles with pixel values containing the visibility level of the pixel from all points.  The table will be indexed, to allow joins.

 

If the visibility level of the pixel is positive or zero, the pixel is visible from all points. If the visibility level of the pixel is negative, it contains the difference between the height at which all points become visible and the height of the pixel.  The bigger the magnitude of the value, the more the pixel has to be raised to become visible from all points.

 

Viewshed creation parameters are: an optional field to use for Z values.  If the name of the Z field is a blank string, the function uses Z data stored in geometry values. When using a field for Z values, the <relativeZ> parameter specifies whether Z values for points in the drawing are relative to heights in the image (true) or are absolute heights (false), the maximum visible radius (a negative value or zero means there is no limit), and minimum and maximum angles of the camera in degrees (-90 / 90 means that there are no limits).

TileViewshedTilesLevelAllPar(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>, <config>): <table>

A parallel form of the TileViewshedTilesLevelAll function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedTilesLevelAll function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedTilesLevelAny(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>, <angleMax>): <table>

Takes the same parameters as TileViewshedTilesLevelAll and returns a table with tiles with pixel values containing the visibility level of the pixel from any point.  The table will be indexed, to allow joins.

 

If the visibility level of the pixel is positive or zero, the pixel is visible from any point. If the visibility level of the pixel is negative, it contains the difference between the height at which any point becomes visible and the height of the pixel.  The bigger the magnitude of the value, the more the pixel has to be raised to become visible from any point.

TileViewshedTilesLevelAnyPar(<viewsheds>, <drawing>, <fieldZ>, <relativeZ>, <radiusMax>, <angleMin>,<angleMax>, <config>): <table>

A parallel form of the TileViewshedTilesLevelAny function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileViewshedTilesLevelAny function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileViewshedTraceLine(<viewsheds>, <beg>, <end>, <relativeZ>, <angleMin>, <angleMax>): <level>

Takes a viewshed buffer, begin and end XYZ coordinates, and viewshed creation parameters, and returns the visibility level of the end coordinate from the begin coordinate.

 

If the visibility level is positive or zero, the end coordinate is visible from the begin coordinate. If the visibility level is negative, it contains the difference between the height at which the end coordinate becomes visible and the height of the coordinate.  The bigger the magnitude of the value, the more the end coordinate has to be raised to become visible from the begin coordinate.

 

Viewshed creation parameters are: an option of whether Z values for points in the drawing are relative to heights in the image (true) or are absolute heights (false), the maximum visible radius (a negative value or zero means there is no limit), and minimum and maximum angles of the camera in degrees (-90 / 90 means that there are no limits).

TileWatershedAreas(<watersheds>, <flowMin>): <table>

Takes a watershed object and a number for minimum flow, and returns a table of watershed areas with fields for: Geom, Stream, Target, OrderShreve, OrderStrahler, Value and ValueSum.  See illustrations and examples in the Watersheds topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedAreasPar(<watersheds>, <flowMin>, <config>): <table>

A parallel form of the TileWatershedAreas function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedAreas function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedAreasSinks(<watersheds>, <keepEscaping>): <table>

Takes a watershed object and a Boolean flag,, and returns a table of watershed areas for all sinks with a Value field giving the flow in each sink.   The <keepEscaping> Boolean flag specifies whether to keep (true) or discard (false) areas that flow out of the image.  See illustrations and examples in the Watersheds topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedAreasSinksPar(<watersheds>, <keepEscaping>, <config>): <table>

A parallel form of the TileWatershedAreasSinks function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedAreasSinks function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedAreaUpstream(<watersheds>, <coordx2>): <geom>

Takes a watershed object and a float64x2 coordinate, and returns the upstream watershed area for the coordinate with a Value field giving the flow in the area.  See illustrations and examples in the Watersheds topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedAreaUpstreamPar(<watersheds>, <coordx2>, <config>): <geom>

A parallel form of the TileWatershedAreaUpstream function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedAreaUpstream function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedAreasUpstream(<watersheds>, <drawing>, <keepOverlaps>): <table>

Takes a watershed object and a drawing for points, and returns a table of upstream watershed areas for each point with a Value field giving the flow in each area, and a Coord field giving the float64x2 coordinates of each source point. The <keepOverlaps> Boolean keeps overlaps if true and eliminates overlaps if false.  See illustrations and examples in the Upstream Areas and Lines topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedAreasUpstreamPar(<watersheds>, <drawing>, <keepOverlaps>, <config>): <table>

A parallel form of the TileWatershedAreasUpstream function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedAreasUpstream function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedLines(<watersheds>, <flowMin>): <table>

Takes a watershed object and a number for minimum flow, and returns a table of watershed stream lines with fields for: Geom, Stream, Target, OrderShreve, OrderStrahler, Value and ValueSum.  See illustrations and examples in the Watersheds topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedLinesPar(<watersheds>, <flowMin>, <config>): <table>

A parallel form of the TileWatershedLines function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedLines function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedLineDownstream(<watersheds>, <coordx2>): <geom>

Takes a watershed object, a float64x2 coordinate, and a number for minimum flow, and returns the downstream watershed line for the coordinate. See illustrations and examples in the Watersheds topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedLineDownstreamPar(<watersheds>, <coordx2>, <config>): <geom>

A parallel form of the TileWatershedLineDownstream function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedLineDownstream function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedLinesDownstream(<watersheds>, <drawing>, <keepOverlaps>): <table>

Takes a watershed object, a drawing for points, and returns a table of downstream watershed lines for each point with a Coord field giving the float64x2 coordinates of each source point.  The <keepOverlaps> Boolean keeps overlaps if true and eliminates overlaps if false.   See illustrations and examples in the Downstream Lines topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedLinesDownstreamPar(<watersheds>, <drawing>, <keepOverlaps>, <config>): <table>

A parallel form of the TileWatershedLinesDownstream function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedLinesDownstream function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedLineUpstream(<watersheds>, <coordx2>, <flowMin>): <geom>

Takes a watershed object, a float64x2 coordinate, and a number for minimum flow, and returns the upstream watershed line for the coordinate.  See illustrations and examples in the Upstream Areas and Lines topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedLineUpstreamPar(<watersheds>, <coordx2>, <flowMin>, <config>): <geom>

A parallel form of the TileWatershedLineUpstream function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedLineUpstream function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedLinesUpstream(<watersheds>, <drawing>, <flowMin>, <keepOverlaps>): <table>

Takes a watershed object, a drawing for points, and a number for minimum flow, and returns a table of upstream watershed lines for each point with a Value field giving the flow, and a Coord field giving the float64x2 coordinates of each source point.  The <keepOverlaps> Boolean keeps overlaps if true and eliminates overlaps if false.    See illustrations and examples in the Watersheds topic.  Create a watershed object using  TileWatershedMakePar or TileWatershedMakeDirPar.

TileWatershedLinesUpstreamPar(<watersheds>, <drawing>, <flowMin>, <keepOverlaps>,<config>): <table>

A parallel form of the TileWatershedLinesUpstream function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedLinesUpstream function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedMake(<image>, <channel>, <channelWeights>): <watersheds>

Takes an image with a channel that contains heights and, optionally, a channel that contains precipitation weights, containing heights, and returns a watershed object  (a table).   The watershed object can be passed to various TileWatershedxxx functions to create desired geometries.

 

To use weights, pass an image with at least two channels, giving heights in the specified channel and giving weights in the other specified channel.  If the weight channel number is a negative value, all pixels are assumed to have equal precipitation.  Weights indicate the amount of precipitation on that pixel.  For example, a weight of 2 in a pixel would indicate twice the precipitation of  weight of 1 in a pixel.  

 

We often want to compute various geometries on the same watershed, such as watershed areas, watershed lines, upstream watershed areas, etc.  But watersheds are costly to compute:  if we want three different geometries it is wasteful to compute the watershed three times, once within each function.   Using TileWatershedMake we can compute the watersheds object just once and then reuse that same watersheds object three times for quick computations of geometry desired.

 

Watersheds can be computed either from images that have a height in each pixel, or from images that have a direction in each pixel.   Instead of having two different forms of each geometry function (one using heights and one using directions), we can have just one form of each geometry function that takes a watershed object.   

 

We can then compartmentalize the creation of watershed objects into two different Make functions, one which creates watershed objects from heights, TileWatershedMake, and the other which creates watershed objects from directions, TileWatershedMakeDir.

 

This greatly reduces the number of different functions, while retaining the flexibility of creating whatever geometry is desired from watersheds that are created either from heights or from directions.

 

For an example of use, see the Upstream Areas and Lines topic.

TileWatershedMakePar(<image>, <channel>, <channelWeights>, <config>): <watersheds>

A parallel form of the TileWatershedMake function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedMake function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileWatershedMakeDir(<imageDir>, <channel>, <channelWeights>): <watersheds>

Takes an image with a channel that contains directions and, optionally, a channel that contains precipitation weights, containing heights, and returns a watershed object  (a table).   The watershed object can be passed to various TileWatershedxxx functions to create desired geometries.

 

Directions are one of eight integer numbers from 0 to 7 as given in the Flow Direction and Accumulation  topic.

 

To use weights, pass an image with at least two channels, giving directions in the specified channel and giving weights in the other specified channel.  If the weight channel number is a negative value, all pixels are assumed to have equal precipitation.   Weights indicate the amount of precipitation on that pixel.  For example, a weight of 2 in a pixel would indicate twice the precipitation of  weight of 1 in a pixel.

 

We often want to compute various geometries on the same watershed, such as watershed areas, watershed lines, upstream watershed areas, etc.  But watersheds are costly to compute:  if we want three different geometries it is wasteful to compute the watershed three times, once within each function.   Using TileWatershedMakeDir we can compute the watersheds object just once and then reuse that same watersheds object three times for quick computations of geometry desired.

 

Watersheds can be computed either from images that have a height in each pixel, or from images that have a direction in each pixel.   Instead of having two different forms of each geometry function (one using heights and one using directions), we can have just one form of each geometry function that takes a watershed object.   

 

We can then compartmentalize the creation of watershed objects into two different Make functions, one which creates watershed objects from heights, TileWatershedMake, and the other which creates watershed objects from directions, TileWatershedMakeDir.

 

This greatly reduces the number of different functions, while retaining the flexibility of creating whatever geometry is desired from watersheds that are created either from heights or from directions.

 

For an example using a Make function, see the Upstream Areas and Lines topic.

TileWatershedMakeDirPar(<image>, <channel>, <channelWeights>, <config>): <watersheds>

A parallel form of the TileWatershedMakeDir function that takes a parameter for the suggested number of threads as encoded in the JSON <config> string as "threads".  If the number of threads is less than or equal to 1 the TileWatershedMakeDir function will be executed.  Use ThreadConfig to generate a JSON string with the desired number of threads.

TileY0(<tile>) : <tile>

A Bessel function of the second kind: Given a tile value returns a tile with pixel values set to the result of the Bessel Function Y0(x) using the input tile pixel values.  

TileY1(<tile>) : <tile>

A Bessel function of the second kind: Given a tile value returns a tile with pixel values set to the result of the Bessel Function Y1(x) using the input tile pixel values.  

TileYn(<order>, <tile>) : <tile>

The nth Bessel function of the second kind: Given an order and a tile value returns a tile with pixel values set to the result of the Bessel Function Yn(x) for order n using the input tile pixel values.  

 

Notes

New functions - The list in this topic is intended to be comprehensive but might be not up to date.  New items are often added with updates to Manifold and may appear in the product before they appear in this documentation.   See the list in the query builder tab of the Command Window for an authoritative list of operators, commands and functions.

 

Operators - Many SQL Operators also work with tiles.   For example, the NOT, AND, OR, and XOR Boolean operators work with numeric tiles, where the tile contains values of 0 or any other number.  0 is interpreted as FALSE and any other value is TRUE.   The result is a numeric tile with 0 values for FALSE and 1 values for TRUE.  Comparison operators (<>, =, >=, >, <=, and <) also work with tiles, and with tiles and a number, producing a numeric tile with values of 0 or 1.  The BETWEEN operator also works with tiles and produces a numeric tile with values of 0 or 1.  See the SQL Operators  topic.

 

TileGeom functions in Release 9 compared to Release 8 -   Release 9 provides an upgrade for geometry (vector) to raster operations compared to Release 8.  Most of the considerations that follow involve fine details down to the level of individual pixels, to cover cases where very precise vector objects touch only part of a pixel:

 

 

 

TileFillMissingNearest in Release 9 compared to Interpolation functions in Release 8 - The TileFillMissingNearest function is similar to surface interpolation functions in 8, but there are two important differences:

 

 

 

Functions retaining the original tile type - Functions such as TileFill and several other functions retain the original tile type. What does this mean? Consider a simple example:

 

? TileJson(TileFill(TileMake(3, 3, CAST(1 AS UINT8)), 5))

 

The above creates a 3x3 tile of type UINT8 filled with the value 1 in each pixel.  It then refills the tile with the value 5 in each pixel.  Finally, it outputs the result as a JSON string. The result is what we would expect: [ 5, 5, 5, ... ]

 

Consider a variation:

 

? TileJson(TileFill(TileMake(3, 3, CAST(1 AS UINT8)), -1))

 

This creates the same tile as before but then tries to refill it with a value of -1 in each pixel.  The result is: [ 255, 255, 255 ... ].

 

What happened? Because TileFill keeps the original tile type, in this case an unsigned eight bit number, the value of -1 was converted to UINT8 and this produced the value 255, the unsigned eight bit equivalent of the number -1.   

 

Other frequent conversions to keep in mind are from doubles to ints, where values are cut, and from numbers to xN values or vice versa, where values get padded or are cut.

 

Filters - For information on functions that use a <filter> argument or which produce a filter definition matrix, see the How Matrix Filters Work topic.

 

What are the built-in filters? -  Functions that are named beginning with TileFilterDef define a filter tile definition for subsequent use by TileFilter.  To see the filter matrix those functions generate we can use TileJson.  For example, to see what TileFilterDefSquare(1,1) generates using arguments that specify a radius of 1 to get a 3x3 matrix, and a center of 1, we can launch the Command Window and enter:

 

? TileJson(TileFilterDefSquare(1, 1))

 

Press the ! Run button and the Log pane of the Command Window reports:

 

> ? TileJson(TileFilterDefSquare(1, 1))

nvarchar: [

 1, 1, 1,

 1, 1, 1,

 1, 1, 1

]

 

Some of the built-in filter definition functions generate much more complex filter matrix definitions than we would want to keyboard manually.  For example:

 

? TileJson(TileFilterDefEdges(1, 1))

 

Reports:

 

> ? TileJson(TileFilterDefEdges(1, 1))

nvarchar: [

 -0.0009872784326934365, -0.03888148788384807, -0.0009872784326934365,

 -0.03888148788384807, 1, -0.03888148788384807,

 -0.0009872784326934365, -0.03888148788384807, -0.0009872784326934365

]

 

Most filter matrices published on various web sites use simpler forms, or provide fractions in the matrix filter cells instead of long decimal fractions.

 

GPGPU - Manifold automatically uses GPU parallelism (see the GPGPU topic) in functions where it makes sense to do so and when workflow is such that it is worth it to dispatch to GPU instead of simply using CPU parallelism.  In many cases both CPU parallelism and GPU parallelism will be used.  For example, all Kriging implementations (standard, median polish, and regression Kriging) use GPU, if available, to compute model parameters together with CPU parallelism in other parts of the function's operation.  GPU cards are so cheap that it doesn't make sense to try to guess when it pays to use GPGPU: simply install a GPU card, at least a cheapo GPU card.  Always.  Do not overthink it.  Just install an NVIDIA GPU card.

 

Why a GPU parallelism limit to radius/border of 8 or less? - Filter functions using a <radius> argument to set the size of the filter matrix applied typically are limited to a radius of 8 or less for GPGPU parallelism, switching to CPU parallelism at a radius of 9 or greater.   Calls to tile functions which use borders of 9 or more pixels likewise automatically dispatch to CPU parallelism.  In both cases, calls dispatched to CPU parallelism can freely intermix with calls dispatched to GPU parallelism.   

 

Those limitations allows more flexible use of a greater range of GPU cards.  Some cards, perhaps older cards or lower cost cards, may have limited memory or earlier generation GPU chips, but they nonetheless can provide very many cores for GPGPU parallel computation.  Manifold makes it possible to use such cards effectively for GPGPU parallelism.  

 

A radius of 8 implies a 17x17, 289-cell matrix, an absurdly huge and almost always an excessively large choice for matrix size.  A radius of 9 or above may indicate a conceptual error or workflow error.   At the same time, use of a radius of 9 or above requires so much GPU-accessible memory that such tasks fit into fewer and fewer cards, even if performance-reducing methods are adopted.   Given a choice between assuring a wide range of GPU cards will always work well, or restricting GPU choice to allow practices that are probably wrong in any event, Manifold chooses to support a wider range of GPU cards, placing the current switch to CPU parallelism at a radius or border of 9.  That may change as CUDA editions evolve.

 

Invisible pixels and filters - A difference in handling invisible pixels between Release 8 and Release 9 emerges when using functions such as TileFilterMax,  TileFilterMajor and similar matrix filter functions:  The surface evaluator tool in 8 was produces a visible pixel if at least one pixel in the vicinity is visible, which could make some invisible pixels visible.  In Release 9 invisible pixels stay invisible and visible pixels generally stay visible.  Visible pixels only turn invisible if non-zero filter coefficients all fall onto invisible pixels.  If the center value for a filter is non-zero, then visible pixels will always stay visible.

 

TileTrace functions - TileTrace functions track the number of different pixel values they encounter, and thus the number of different "bins" for which areas should be created, and stop if that number gets too big.  Currently, the limit is 20,000. Having too many different pixel values usually means that the image has to be preprocessed or that the function has to be called with a higher quantization factor to make the results usable.

 

Division by zero - returns NULL.

 

All types of values - Operators and functions generally  support all types of values so that, for example, we can use comparison or boolean operators on tiles and not just on scalar values.  

 

Everything Math - For a handy reference to anything in mathematics, see the Wolfram MathWorld site.   Thank you, Wolfram!

 

See Also

Tables

 

Add an Index to a Table

 

Functions

 

Queries

 

Regular Expressions

 

How Matrix Filters Work

 

Command Window

 

Command Window - Query Builder

 

Identifiers, Constants and Literals

 

SQL Statements

 

SQL Operators

 

SQL Functions

 

Aggregate SQL Functions

 

Coord SQL Functions

 

Geom SQL Functions

 

String SQL Functions

 

Other SQL Functions

 

Temporary Databases

 

EXECUTE

 

Example: Create and Run a Query -  See how the different parts of a command window operate when creating and running SQL queries.   Includes use of the Log tab as well as the ?expression and !fullfetch commands.

 

Example: Transfer DEM Terrain Heights to Areas in a Drawing - Given a map with an image layer that shows terrain heights taken from a DEM, and a drawing layer that contains areas, using a small SQL query we transfer the average terrain height within each area to that area as a Height attribute for the area. Easy!

 

SQL Example: Process Images with 3x3 Filters -  Shows a step-by-step example of developing an SQL query that takes a query written by the Edit Query button and then modifies that query into a general purpose query that can apply any 3x3 filter.   This makes it easy to use matrix filters we find on the web for custom image processing.   We extend the query by using parameters and adding a function, and then show how it can be adapted to use a 5x5 filter.

 

SQL Example: Process Images using Dual 3x3 Filters  - A continuation of the above topic, extending the example query to utilize two filters for processing, as commonly done with Sobel and Prewitt two filter processing.

 

SQL Example: Process RGB Images using Matrix Filters - A continuation of the above two topics, extending the example query to process three channel, RGB images.

 

SQL Example: Miscellaneous SQL Functions - A variety of small examples using SQL functions.

 

SQL Example: GeomOverlayAdjacent Function - Using the GeomOverlayAdjacent function, an example that shows how this function and similar functions such as GeomOverlayContained, GeomOverlayContaining, GeomOverlayIntersecting and GeomOverlayTouching operate.

 

SQL Example: GeomOverlayTopologyUnion Function - A continuation of the SQL Example: GeomOverlayAdjacent Function example, using the GeomOverlayTopologyUnion function, an example that shows how this function and similar functions such as GeomOverlayTopologyIdentity, GeomOverlayTopologyIntersect and GeomOverlayTopologyUpdate operate.

 

Example: Merge : areas (dissolve) - In this example we combine multiple area objects into a single area object by using the Merge template in the Transform pane, using the areas (dissolve) option.  A drawing of French regions shows some regions as more than one area.  We would like each region to be one area so the table of regions has one record per region.

 

SQL Example: Learn SQL from Edit Query - Merging Areas - We learn how to write an SQL query that does a Merge : area (dissolve) operation by cutting and pasting from what the Edit Query button automatically generates.

 

Example: Use a Transform Expression to Create Buffers in a Drawing - Use the Expression tab of the Transform pane to create three different sizes of buffers for different lines in a drawing and then automatically create a query which does the same thing.  Includes examples of using the Add Component button and also the Edit Query button.

 

Example: Clip Areas with a Transform Expression - Use the Expression tab of the Transform pane to clip areas in a drawing to fit within horizontal bounds.   Includes examples of using the Add Component button and also the Edit Query button.

 

Example: Transform Templates, Expressions and Queries - We learn to use a function by clicking on a template in the Transform pane, seeing what it does in a preview, looking at the query Manifold creates and then trying out the function in the Expression tab.

 

SQL Example: List Transformation Grids - In this example we use a few snippets of easy SQL to list NTv2 and NADCON transformation grids that are available within the grids.dat compressed collection of transformation grid files.   Grid transformation files can be used when creating custom base coordinate systems, for NADCON / HARN / HPGN and NTv2 high accuracy transformations that use grid files.