All Products
Search
Document Center

:ST_SetCost

Last Updated:Apr 01, 2024

This topic describes the ST_SetCost function. This function assigns a traversing cost value to an array of specified grids with barriers.

Syntax

gridcost ST_SetCost(geomgrid[] barriers, smallint cost);

Parameters

Parameter

Description

barriers

The array of geographic grids.

cost

The traversing cost value that is assigned to an array of grids. If you set this parameter to -1, the array of specified grids cannot be traversed.

Description

This function assigns a traversing cost value to an array of specified grids with barriers. If you set the cost parameter to -1, the array of specified grids cannot be traversed. The value of the cost parameter for the remaining grids is calculated based on the equivalent distance. The equivalent distance refers to the notion of equating the cost of traversing a grid with barriers to the cost of traversing a number of grids without barriers.

Examples

select st_setcost(array[st_gridfromtext('GZ01'), st_gridfromtext('GZ1')],1);

-----------------------------------------------
 ("{01024002000001000000,0102410100000000}",1)