This topic describes the ST_VoronoiLines function. This function computes a two-dimensional Voronoi diagram by using the vertices of a geometry object and returns the boundaries between cells in the Voronoi diagram as a MultiLineString object.


geometry  ST_VoronoiLines(geometry  g1, float  tolerance, geometry  extend_to);


Parameter Description
g1 The geometry object that you want to specify.
tolerance The tolerance. Default value: 0.0. If the distance between the two vertices of the geometry object is smaller than the value of the tolerance parameter, the two vertices are coincident. You can specify a value that is not zero for the tolerance parameter to increase the robustness of the algorithm.
extend_to The extended envelope. Default value: null. If you set this parameter to null, the default envelope is the bounding box that is extended by approximately 50% in each direction of the geometry object. If you specify this parameter, the Voronoi diagram is extended to cover the extended envelope, unless the extended envelope is smaller than the default envelope.


  • If the specified geometry object is NULL, the ST_VoronoiLines function returns NULL.
  • If the specified geometry object contains only one vertex, the ST_VoronoiLines function returns an empty GeometryCollection object.
  • If the area of the extended envelope that is specified by the extend_to parameter is zero, the ST_VoronoiLines function returns an empty GeometryCollection object.


Process a geometry object by using the default parameter settings.
SELECT ST_VoronoiLines(g),g
             from (select ST_Buffer('LINESTRING(0 0,3 0,3 3)'::geometry,1,'join=mitre endcap=square') as g) as t;