| 1 | 1 | new file mode 100644 | 
| ... | ... | @@ -0,0 +1,27 @@ | 
| 1 | +import shapefile | |
| 2 | + | |
| 3 | +sf = shapefile.Reader("pyshp/shapefiles/blockgroups") | |
| 4 | + | |
| 5 | +print sf.shapeType | |
| 6 | + | |
| 7 | +shapes = sf.shapes() | |
| 8 | + | |
| 9 | +print len(shapes) | |
| 10 | + | |
| 11 | +s = sf.shape(7) | |
| 12 | +print ['%.3f' % coord for coord in s.bbox] | |
| 13 | + | |
| 14 | +for name in dir(shapes[3]): | |
| 15 | +    if not name.startswith('_'): | |
| 16 | + print name | |
| 17 | + | |
| 18 | + | |
| 19 | +fields = sf.fields | |
| 20 | +print fields | |
| 21 | + | |
| 22 | +shapeRecs = sf.shapeRecords() | |
| 23 | + | |
| 24 | +print len(shapeRecs) | |
| 25 | + | |
| 26 | +print shapeRecs[0].record[1:3] | |
| 27 | +print shapeRecs[0].shape.points[0:2] |