[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    RE: [postgis-users] Cut Shapefiles At A Border
From:       "Paragon Corporation" <lr () pcorp ! us>
Date:       2008-09-28 8:16:41
Message-ID: 7D07878778D0464A9A9E12B688C4FED0 () k
[Download RAW message or body]

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: postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] 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: postgis-users-bounces@postgis.refractions.net
> [mailto:postgis-users-bounces@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@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>   
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic