Database Reference
In-Depth Information
SELECT ST_AsText(the_geom) AS pstring
FROM (
SELECT (ST_DumpPoints(the_geom)).geom AS
the_geom, gid AS gid FROM
chp04.voronoi_test_points
) AS point_dump;
The preceding function returns the following output:
pstring
-------------
POINT(5 7)
POINT(2 8)
POINT(10 4)
POINT(1 15)
POINT(4 9)
POINT(8 3)
POINT(5 3)
POINT(20 0)
(8 rows)
We should review some design considerations in the preceding function. Note the
use of ST_DumpPoints here. You might ask why, if we are feeding in points, we
arecalling ST_DumpPoints .Thisistogeneralizethefunction,sothatwecanfeed
in polygons or lines if we choose to and thus grab all the points from the polygons
orlinesforaVoronoiapplication.Thisalsoallowsthefunctiontoapplytomultipoint
geometries without modification.
Alsonote,thisisnotyetintheformatanticipatedbypyhull.Wewillneedtodosome
additional text manipulation. Our string, if you recall, should look more like the fol-
lowing:
[[5, 6], [2, 8], [10, 4]... [20,0]]
In the first step, we will replace all spaces in our points with commas:
Search WWH ::




Custom Search