sukri12 / pysal

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

Compute centroids of polygons with holes #138

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
PySAL does not compute the centroid of polygons with holes.  The code currently 
catches the case and returns meaningful feedback to the user.  As a result, 
functions like knnW_from_shapefile() return a not implemented exception for 
shapefiles with holes.

Original issue reported on code.google.com by dfo...@gmail.com on 27 Jan 2011 at 12:34

GoogleCodeExporter commented 8 years ago

Original comment by schmi...@gmail.com on 27 Jan 2011 at 12:46

GoogleCodeExporter commented 8 years ago
we will return a centroid, default being geometric center (weighted avg of  
ring centroids) but with options

- centroid of bb
- centroid of largest ring
- centroid ring centroid - ring centroid closest to the geometric centroid

Original comment by sjsrey on 13 Apr 2011 at 11:42

GoogleCodeExporter commented 8 years ago
All polygons currently get a bounding box

Need to at least have an option that matches geoda

Original comment by dfo...@gmail.com on 18 May 2011 at 4:51

GoogleCodeExporter commented 8 years ago
added a work around for this issue in revision 921, will now compute centroids 
for polygon's with holes.  Holes are simply ignored and a warning is issued.

We can implement the other methods in standalone and eventually replace the 
method in the Polygon class.

Lowering priority as to normal, we users can now get back a centroid for any 
polygon.

Original comment by schmi...@gmail.com on 19 May 2011 at 5:46

GoogleCodeExporter commented 8 years ago

Original comment by dfo...@gmail.com on 19 May 2011 at 6:39

GoogleCodeExporter commented 8 years ago
Implemented "center of gravity" Centroid calculations for polygons with 
multiple parts and holes using geometric decomposition, 
http://en.wikipedia.org/wiki/Centroid#By_geometric_decomposition

The test the results we (Phil) calculated the centroids of US Counties using 
ArcMap.
The cumulative error from our old method (ignoring holes) is approx 3.3 km.
The cumulative error from the new method is approx 0km.

The new method is implemented twice, once in standalone.polygon_centroid_decomp 
and once in shapes, as part of Polygon's centroid property and the new Ring 
class. The former should be removed before release.

Added in r1072

Original comment by schmi...@gmail.com on 11 Jan 2012 at 11:53

GoogleCodeExporter commented 8 years ago
Removed standalone version in r1101.  Closing ticket.

Original comment by schmi...@gmail.com on 24 Jan 2012 at 3:44