Thank you Jeff. I'll try out this solution.

Gary.

Jeff Whitaker wrote:
<snip>

> Gary:  You might be able to use the _geoslib module to compute the 
> intersections of those polygons with the map boundary.  I do a similar 
> thing with the coastline polygons in the _readboundarydata function.    
> The _boundarypolyll and _boundarypolyxy instance variables have the 
> vertices of the map projection region polygons in lat/lon and projection 
> coords.  You could do somethig like this:
> 
>            from mpl_toolkits.basemap import _geoslib
>            poly = _geoslib.Polygon(b) # a geos Polygon instance 
> describing your polygon)
>            b = self._boundarypolyxy.boundary
>            bx = b[:,0]; by= b[:,1]
>            boundarypoly = _geoslib.Polygon(b) # a geos Polygon instance 
> describing the map region
>            if poly.intersects(boundarypoly):
>                    geoms = poly.intersection(boundarypoly)
>                    polygons = [] # polygon intersections to plot.
>                    for psub in geoms:
>                            b = psub.boundary # boundary of an intersection
>                            polygons.append(zip(b[:,0],b[:,1]))
> 
> -Jeff

<snip>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to