[postgis-users] Can I Clip Layers?

David Blasby dblasby at refractions.net
Thu Mar 25 09:14:58 PST 2004


Darren Houston wrote:
> Hello strk,
> 
> Thank you for your answer.
> 
> The intersects() function is the function I have been using. The problem is
> that it will show the whole geometry, not "clip" the geometry at the extent of
> the BOX3D or polygon. I have included some pictures of my output that shows
> the river and grid system outside my polygon because intersects() returns true
> for an intersecting geometry, and hence my sql returns the whole geometry. I
> could "fake it" for now and draw a white square outside my polygon area to
> cover anything outside. Ideally, it would be grand if there was some way
> PostGIS could clip one layer based on another. I hope I explained myself well,
> if not the pictures should help.
> 


SELECT intersection(the_Geom, <box3d>) FROM <table> WHERE the_Geom && 
<box3d>;

this should do what you want.

dave



More information about the postgis-users mailing list