[postgis-users] intersecting and exporting

Seb spluque at gmail.com
Fri Nov 9 09:04:50 PST 2012

On Fri, 9 Nov 2012 15:21:23 +0100,
"Francois Hugues" <hugues.francois at irstea.fr> wrote:

> The right use of st_intersection imply the use of st_intersects in the
> where clause to avoid unuseful empty geometry collection.  Here is how
> I would have write your query :

> select gid, st_intersection(a.geom, b.geom) as geom from gshhs_c_l1 as
> a, regions as b Where gid=4 and id=1 and st_intersects(a.geom, b.geom)

> Could you try this and tell us if it's work please ?

Indeed, taking into account your recommendations:

    ST_Intersection(a.geom, b.geom) AS geom
FROM gshhs_c_l1 AS a, regions AS b
WHERE a.gid=4 AND b.id=1 AND ST_Intersects(a.geom, b.geom);

makes qgis' "add PostGIS layer" dialog happy, and the "waiting" messages
were replaced with the appropriate info after several seconds.  The
postgres process still revs up to 25% but then ends.

At some point, however, I'd still like to be able to output the PostGIS
data to some format that would allow me to plot with GMT.  How does one
export PostGIS data?  Is ogr2ogr the way to go?

Thank you very much Francois, Sandro,


More information about the postgis-users mailing list