google-code-export / pysal

Automatically exported from code.google.com/p/pysal
Other
1 stars 1 forks source link

Rook weights incorrect for STL_HOM.shp #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The ROOK weights builder in PySAL is returning incorrect results for the 
STL_HOM example dataset. Regions 75 and 76 (starting from 1) are not counted as 
neighbors.  This bug occurs with both the Rtree and Binning builders.

Reported by Serge.

Original issue reported on code.google.com by schmi...@gmail.com on 13 Nov 2010 at 12:58

Attachments:

GoogleCodeExporter commented 9 years ago
Test data added to trunk in r587

Original comment by schmi...@gmail.com on 13 Nov 2010 at 1:00

GoogleCodeExporter commented 9 years ago
Problem appears to be in the "Double Check" section that is common to both the 
rtree and binning algos.  In the double check the matching segment is 
dismissed.  This appears to be a special case, the segment in common is the 
last segment of one polygon and the first segment of the other polygon.  
Working on a new function to systematically check for segments in common. 

Test case added in r588.

Original comment by schmi...@gmail.com on 13 Nov 2010 at 1:05

GoogleCodeExporter commented 9 years ago
I add a function "get_shared_segment(poly1,poly2)" to standalone and changed 
the builders to us this method to double check links.  The new unit test 
passes, however some others now fail.  Double checking the old unit tests to 
make sure they aren't bad tests. Will commit when all tests pass.

Original comment by schmi...@gmail.com on 13 Nov 2010 at 3:16

GoogleCodeExporter commented 9 years ago
Changed get_shared_segments function to check holes and added a "bool_ret" 
option which will return True/False when set to True.  This allows the function 
to return on the first shared sedge found, instead of counting them all.

Changed doctest in pysal/weights/__init__.py:107
Adjusted histogram counts to match a GAL created by OpenGeoDa.

test_weights.py is still failing, but I believe the tests are incorrect, will 
issue another ticket to check the validity of those tests.

Original comment by schmi...@gmail.com on 14 Nov 2010 at 7:35