[postgis-users] clip polygons

Nicolas Ribot nicolas.ribot at gmail.com
Mon Jan 14 09:13:51 PST 2013


Hi,

You also have to perform the actual intersection if you want to clip your
data, not only the intersect test:

SELECT area, st_intersection(a.the_geom, b.geom) as geom
    FROM oc a, co b
    WHERE st_intersects(a.the_geom, b.the_geom)

Nicolas


On 14 January 2013 18:01, Marta Debolini <martadebolini at gmail.com> wrote:

> Hi,
> I am a new postgis user, so sorry if my request seems trivial for someone.
>
> I have to clip a polygon with another polygon file. I was used to do this
> operation with the simple comand "clip" in GRASS or QGIS.
> How can I do the same operation in postgis? I tried with sy_intersect, but
> it takes also the polygons outside my area, which simply intersect the
> border.
> The request I wrote is:
>
>
> CREATE TABLE w_md.x
> AS (SELECT area, a.the_geom
>     FROM oc a, co b
>     WHERE st_intersects(a.the_geom, b.the_geom));
>
>     ALTER TABLE w_md.x_1999 ADD column ggid1 serial;
>      ALTER TABLE w_mdi.x_1999 ADD PRIMARY KEY (ggID1);
>
> Thank you for your help,
>
> Marta
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130114/8e8d180c/attachment.html>


More information about the postgis-users mailing list