Thread: a spatial table's bounding box

a spatial table's bounding box

From
Asli Akarsakarya
Date:
Hello, 

My question is a basic one for postGIS, I believe. It should have a primitive answer somewhere, but I don't have it. 

I want to get the extensions of  spatial table. Say that there is a spatial table named 'roads', and a some road geometry inside. I want to fetch the bounding box (envelope or extension) for that table, that means for all the roads that it has. 

According the OGC specification, this should be defined in the "geometry_columns" table. As four columns, "minX", "minY", "maxX" and "maxY". But I couldn't find it anywhere on my postgis. Yet.

From which table/view? With what SQL?

Thanks for your answers,

Aslı.

Re: a spatial table's bounding box

From
Filip Rembiałkowski
Date:


2011/9/22 Asli Akarsakarya <asliakar@yahoo.com>

I want to get the extensions of  spatial table. Say that there is a spatial table named 'roads', and a some road geometry inside. I want to fetch the bounding box (envelope or extension) for that table, that means for all the roads that it has. 

According the OGC specification, this should be defined in the "geometry_columns" table. As four columns, "minX", "minY", "maxX" and "maxY". But I couldn't find it anywhere on my postgis. Yet.

From which table/view? With what SQL?


 
I would try

SELECT st_envelope( st_collect(geom) ) FROM roads;


HTH, Filip


Re: a spatial table's bounding box

From
Asli Akarsakarya
Date:
Thank you very much.

>I would try

>SELECT st_envelope( st_collect(geom) ) FROM roads;

>HTH, Filip
>> I want to get the extensions of spatial table. Say that there is a spatial table named 'roads', and a some road geometry inside. I want to fetch the bounding box (envelope or extension) for that table, that means for all the roads that it has.
>>
>> According the OGC specification, this should be defined in the "geometry_columns" table. As four columns, "minX", "minY", "maxX" and "maxY". But I couldn't find it anywhere on my postgis. Yet.
>>
>> From which table/view? With what SQL?