[postgis-users] Cut Shapefiles At A Border

Dan Blomberg services at gpsfiledepot.com
Sun Sep 28 00:56:26 PDT 2008


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.html
>
> Hope that helps,
> Regina 
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] 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
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>   



More information about the postgis-users mailing list