The need is to retrieve the BOX extent of every group of data.
The gropu are on field ANNO.
The solution is a group by, an Union and the Extent.
So:
select ANNO, ST_Union(GEOMETRY) from the_schema.the_table group by ANNO order by ANNO;
it work.
So I complete composing the string I need.
-----
select
b.anno,
'EXTENT ' || ST_XMin(b.extent)::integer - 100 || ' ' || ST_YMin(b.extent)::integer - 100 || ' ' || ST_XMax(b.extent)::integer + 100 || ' ' || ST_YMax(b.extent)::integer + 100 as extent
from
(
select anno, ST_Extent (geometry) as extent from the_schema.the_table group by anno
) as b
order by
b.anno
;
-----
its all.
Nessun commento:
Posta un commento