Use ST_Intersection In conjunction with ST_Intersects. ST_Intersection will clip the geometries so what is left is what falls inside both geometries.
So something like SELECT i.gid, ST_Intersection(country.the_geom, i.the_geom) FROM country INNER JOIN someothertable i ON ST_Intersects(country.the_geom, i.the_geom) For your countries that are linestrings, you will need to convert them to polygons with something like ST_BuildArea. http://postgis.refractions.net/documentation/manual-svn/ST_BuildArea.html Hope that helps, Regina -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Blomberg Sent: Sunday, September 28, 2008 1:54 AM To: PostGIS Users Discussion Subject: [postgis-users] Cut Shapefiles At A Border Hi, I need to be able to cut shapefiles at a given border. I have a bunch of data for the entire country or an area but I want it to be cut at the border of the state. I have the state as either a line or an area. I saw a previous "thread" here and someone said OpenJump could do this. I downloaded it and used touching, is_within, etc and it selected them but it wouldn't cut at the border so I still had polygons that continued for miles. Is there a way with PostGIS or some other program to cut/trim a series of shapefiles at a border (line) or once they are outside of an area. Any help would be greatly appreciated. Dan http://www.gpsfiledepot.com _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
