Revision: 4193
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4193&view=rev
Author:   jswhit
Date:     2007-11-09 12:00:39 -0800 (Fri, 09 Nov 2007)

Log Message:
-----------
if poly intersection fails, attempt to use the polygon anyway

Modified Paths:
--------------
    trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py

Modified: 
trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py   
2007-11-09 19:48:42 UTC (rev 4192)
+++ trunk/toolkits/basemap-testing/lib/matplotlib/toolkits/basemap/basemap.py   
2007-11-09 20:00:39 UTC (rev 4193)
@@ -841,18 +841,12 @@
                         # if polygon instersects map projection
                         # region, process it.
                         if poly.intersects(boundarypolyll):
-                            #if not poly.is_valid:
-                            #    print poly.geom_type, poly.is_ring, 
boundarypolyll.is_valid
-                            #    import pylab
-                            #    a = npy.asarray(boundarypolyll.boundary)
-                            #    b = npy.asarray(poly.boundary)
-                            #    pylab.plot(a[:,0],a[:,1],'b')
-                            #    pylab.plot(b[:,0],b[:,1],'b')
-                            #    pylab.show()
-                            if poly.is_valid:
+                            # if geometry intersection calculation fails,
+                            # just move on.
+                            try:
                                 poly = poly.intersection(boundarypolyll)
-                            #else:
-                            #    print 'warning, invalid ',name,' 
geometry',poly.area
+                            except:
+                                pass
                             # create iterable object with geometries
                             # that intersect map region.
                             if hasattr(poly,'geoms'): 
@@ -912,15 +906,22 @@
                     # if geometry instersects map projection
                     # region, and doesn't have any invalid points, process it.
                     if not badmask.any() and boundarypolyxy.intersects(poly):
+                        #if not poly.is_valid:
+                        #    print poly.geom_type, poly.is_ring, 
boundarypolyll.is_valid
+                        #    import pylab
+                        #    a = npy.asarray(boundarypolyxy.boundary)
+                        #    b = npy.asarray(poly.boundary)
+                        #    poly2 = boundarypolyxy.intersection(poly)
+                        #    c = npy.asarray(poly2.boundary)
+                        #    pylab.plot(a[:,0],a[:,1],'b')
+                        #    pylab.fill(c[:,0],c[:,1],'r')
+                        #    pylab.show()
                         # if geometry intersection calculation fails,
-                        # just skip this polygon.
-                        #try:
-                        if poly.is_valid:
+                        # just move on.
+                        try:
                             poly = boundarypolyxy.intersection(poly)
-                        #else:
-                        #    print 'warning, invalid ',name,' 
geometry',poly.area
-                        #except:
-                        #    continue
+                        except:
+                            pass
                         # create iterable object with geometries
                         # that intersect map region.
                         if hasattr(poly,'geoms'): 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to