Database Reference
In-Depth Information
ALTER TABLE chp04.voronoi_test_points ADD
PRIMARY KEY (gid);
-- replace this section with generate_series
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (5, 7);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (2, 8);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (10, 4);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (1, 15);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (4, 9);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (8, 3);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (5, 3);
INSERT INTO chp04.voronoi_test_points (x, y)
VALUES (20, 0)
;
SELECT AddGeometryColumn
('chp04','voronoi_test_points','the_geom',3734,'POINT',2);
UPDATE chp04.voronoi_test_points
SET the_geom = ST_SetSRID(ST_MakePoint(x,y),
3734)
WHERE the_geom IS NULL
;
Step one - preparing the input text
Ourfirststepistopreparethepointarraytogointoournewfunction.pyhullexpects
alistofcoordinates,sowewillconstructtextthatapproximatesaPythonlist,know-
ingthatour ast.literal_eval codeinsidethefunctionwillhandletheconversion
to a Python list.
As we want text, we will use the PostGIS function, ST_AsText .
Search WWH ::




Custom Search