Skip to content

Added Reader.iterShapeRecords to help work with larger files #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions shapefile.py
Original file line number Diff line number Diff line change
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