From: Alan G I. <ai...@am...> - 2008-10-20 13:05:16
|
> Mathew Yeates wrote: >> Is there an easy way to find the locations in rectangle1 that are >> covered by rectangle2? I couldn't find this anywhere. On 10/20/2008 7:46 AM Jeff Whitaker apparently wrote: > Mathew: There's nothing included in matplotlib - I recommend Shapely > (http://trac.gispython.org/lab/wiki/Shapely). It's an interface to the > GEOS library, which you already have since you have basemap. Basemap > includes it's own private interface to GEOS, but Shapely has a much > better (although slower), well documented API. But with ordinary rectangles (with sides parallel to the axes), if you can extract their coordinates/size, the analytical problem is trivial: use this info to get the overlap along each axis. If the rectangles share a common transform, this is still pretty easy. So you may be able to avoid a more general solution. I've interpreted the question one way: "covered" might suggest you additionally need the z-order. Cheers, Alan Isaac |