[postgis-users] Split One Layer of Polygons With Another Layer of Polygons?
Paul Ramsey
pramsey at refractions.net
Tue Sep 5 18:06:45 PDT 2006
CREATE TABLE new_fields AS
SELECT intersection(f.the_geom, c.the_geom) as the_geom, f.*, c.clu_name
FROM fields f, clu c
WHERE
f.the_geom && c.the_geom
AND
Intersects(f.the_geom, c.the_geom)
On 5-Sep-06, at 2:31 PM, Bill Thoen wrote:
> Using PopstgreSQL/PostGIS, what are the steps I need to use to
> split one layer of polygons with another layer and also maintain
> data attrributes among the polygons that are split? For example,
> I've got corn and soybean field polygons that need to be split at
> the borders of overlaying CLU (Common Land Unit) polygons, and if a
> corn field crosses under a CLU boundary, I want to split the field
> at the CLU boundary and copy the orignal field id, crop code and
> other attributes into the two (or more) resulting farm field
> polygons (and probably assign a new unique polygon id to them all
> too.)
>
> I'm thinking that the approach would be to create a cursor
> selection of CLUs and for each of these find the set of farm fields
> that overlap it. Then for each of those farm fields, split them
> against the CLU polygon (using Intersection()?) and insert each new
> polygon with associated data into a new table, and deleting the
> orignal farm polygon. Then at the end merge all the split polygons
> back into the orignal table and assign unique ids of all of them.
>
> Is this the right approach? It seems like a bit of a job, but it
> also seems like a common enough operation that I'm wondering if
> there is a simpler way already available in PostGIS or has somebody
> written a function to do this sort of thing?
>
> TIA,
> - Bill Thoen
>
>
> _______________________________________________
> 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