Re: How create a polygon rectangular from the BBOX of ageometry.

Posted by Hugues François on
URL: http://postgis.17.x6.nabble.com/How-create-a-polygon-rectangular-from-the-BBOX-of-a-geometry-tp5002608p5002609.html

Hi,

I think this error comes from a mismatch between your non pojected geometry and column type. You may try :
1. st_SetSRID(st_extent(a.geometry), 3003)
2. you may try another test with something like st_envelope(st_union(st_envelope(a.geometry)))

Hugues.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrea Peri
Sent: Sunday, February 17, 2013 4:06 PM
To: PostGIS Users Discussion
Subject: [postgis-users] How create a polygon rectangular from the BBOX of ageometry.

Hi,

I have a table named "route_streets" with a linear geometry in the epsg:3003.

I try to create a view (v_route_streets)  that has as geometry a polygon with the BBOX of the linear geometry.

To do this I try this sql:

  create view streets.v_route_streets as
    select a.gid, a.ri05_name as name,
ST_Extent(a.geometry)::geometry(POLYGON, 3003) as geometry from streets.route_streets as a group by a.gid,a.ri05_nome;

It is normally created but when try to use it on qgis I'm hhaving an error.
QGIS say that this is not a valid layer.

I don't understand where is the problem.

I'm using postgis 2.0.1

Any hint is welcome,

thx,


--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users