Database Reference
In-Depth Information
),
vpoints AS (
SELECT split_part(vstring, ', 999999999,', 1)
|| ']' AS points
FROM voronoi_string
),
vids AS (
SELECT trim(trailing ']' FROM
split_part(vstring, ', 999999999,', 2)) || ']'
AS ids
FROM voronoi_string
),
Now,weneedtoconvertourpointsintoafloatingpoint, ARRAY (regindex) ,with
anew unique id (gid) generatedon-the-flyusing ROW_NUMBER() and OVER() .
arpt(pts) AS (
SELECT replace(replace((SELECT points FROM
vpoints), ']' ,'}'), '[', '{')::float8[][]
),
reg AS (
SELECT ROW_NUMBER() OVER() As gid, ('{' ||
region[1] || '}')::integer[] as regindex
FROM regexp_matches((SELECT ids FROM vids),
'\[([0-9,\s]+)\]','g')
AS region
),
Wewillseekanormalizedlistoftherelationshipbetweenourpointsandregionsus-
ing the following function:
regptloc AS (
SELECT gid, ROW_NUMBER() OVER(PARTITION BY
gid) AS ptloc, unnest(regindex) As ptindex
FROM reg)
Search WWH ::




Custom Search