[postgis-users] spatial extents of a PostGIS db
Mike Toews
mwtoews at gmail.com
Wed Mar 24 01:29:59 PDT 2010
Hi Paul,
To get the bounds for one layer/table, you need an aggregate
(ST_Collect) and envelope on the aggregate. For one layer/table, it
would look something like:
SELECT ST_AsText(ST_Envelope(ST_Collect(the_geom))) AS envelope FROM mylayer;
And for multiple layers/tables, you need some unions and subqueries:
SELECT ST_AsText(ST_Envelope(ST_Collect(sub_envelope))) AS envelope
FROM
(
SELECT ST_Envelope(ST_Collect(the_geom)) AS sub_envelope FROM layer1
UNION ALL
SELECT ST_Envelope(ST_Collect(the_geom)) AS sub_envelope FROM layer2
)
AS envelopes_from_several_layers;
Which does the envelope of several sub-envelopes. Make sure they all
share the same SRIDs.
-Mike
On 24 March 2010 00:30, Malm Paul <paul.malm at saabgroup.com> wrote:
> Hi List!
>
> I have imported a map with ogr2ogr to a "PostGIS" db, is there a way to find out the spatial extent of this map e.g the envelope that is build from all including layers?
>
> Kind regards,
> Paul
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
More information about the postgis-users
mailing list