Skip to content

Commit

Permalink
Added Reader.iterShapeRecords to help work with larger files
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommi Penttinen committed Oct 1, 2014
1 parent 202143c commit 79cc409
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shapefile.py
Expand Up @@ -15,6 +15,7 @@
import time
import array
import tempfile
import itertools

#
# Constants for shape types
Expand Down Expand Up @@ -552,6 +553,13 @@ def shapeRecords(self):
return [_ShapeRecord(shape=rec[0], record=rec[1]) \
for rec in zip(self.shapes(), self.records())]

def iterShapeRecords(self):
"""Returns a generator of combination geometry/attribute records for
all records in a shapefile."""
for shape, record in itertools.izip(self.iterShapes(), self.iterRecords()):
yield _ShapeRecord(shape=shape, record=record)


class Writer:
"""Provides write support for ESRI Shapefiles."""
def __init__(self, shapeType=None):
Expand Down

0 comments on commit 79cc409

Please sign in to comment.