You can just dump into a new table - the geometry returned by the intersection is what I think you want.
So something like SELECT i.gid, ST_Intersection(idaho.the_geom, i.the_geom) As the_geom INTO newtable FROM idaho INNER JOIN federal_land i ON ST_Intersects(idaho.the_geom, i.the_geom) This will create a new table called newtable. You'll then have to fuss with putting indexes on the table and so forth. Also you may end up with slivers that are lines or whatever that you want to delete by check the Geometrytype(the_geom) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Blomberg Sent: Sunday, September 28, 2008 3:56 AM To: PostGIS Users Discussion Subject: Re: [postgis-users] Cut Shapefiles At A Border Regina, I got the query to run: SELECT i.gid, ST_Intersection(idaho.the_geom, i.the_geom) FROM idaho INNER JOIN federal_land i ON ST_Intersects(idaho.the_geom, i.the_geom) But I don't understand how to make it remove the "outside" area. I assume I have to do some sort of Delete or more likely a copy/insert into a second table with the same structure. That shouldn't be too hard except I'm not sure how to handle the geometries (haven't really gotten the hang of postgis). Thanks Dan Paragon Corporation wrote: > 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.h > tml > > 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 > > _______________________________________________ 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
