Skip to content

Commit b4f2b42

Browse files
committed
Rename m and z range attributes
Rename Reader attributes from "measure" and "elevation", to "mbox" and "zbox". More clear that refers to min/max values, and parallels the names used in the Writer class.
1 parent 893cab9 commit b4f2b42

17 files changed

+8
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Users of the previous version 1.x should therefore take note of the following ch
9999
- More convenient accessing of Record values as attributes. [@philippkraft]
100100
- More convenient shape type name checking. [@megies]
101101
- Add more support and documentation for MultiPatch 3D shapes.
102+
- The Reader "elevation" and "measure" attributes now renamed "zbox" and "mbox", to make it clear they refer to the min/max values.
102103
- Better documentation of previously unclear aspects, such as field types.
103104

104105
### Important Fixes:
@@ -893,7 +894,7 @@ Shapefiles containing M-values can be examined in several ways:
893894

894895
>>> r = shapefile.Reader('shapefiles/test/linem')
895896

896-
>>> r.measure # the lower and upper bound of M values in the shapefile
897+
>>> r.mbox # the lower and upper bound of M values in the shapefile
897898
[0.0, 3.0]
898899

899900
>>> r.shape(0).m # flat list of M values
@@ -926,7 +927,7 @@ To examine a Z-type shapefile you can do:
926927

927928
>>> r = shapefile.Reader('shapefiles/test/linez')
928929

929-
>>> r.elevation # the lower and upper bound of Z values in the shapefile
930+
>>> r.zbox # the lower and upper bound of Z values in the shapefile
930931
[0.0, 22.0]
931932

932933
>>> r.shape(0).z # flat list of Z values

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ VERSION 2.0.0
1818
- More convenient accessing of Record values as attributes. [@philippkraft]
1919
- More convenient shape type name checking. [@megies]
2020
* Add more support and documentation for MultiPatch 3D shapes.
21+
* The Reader "elevation" and "measure" attributes now renamed "zbox" and "mbox", to make it clear they refer to the min/max values.
2122
* Better documentation of previously unclear aspects, such as field types.
2223

2324
Bug Fixes:

shapefile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,15 +701,15 @@ def __shpHeader(self):
701701
# The shapefile's bounding box (lower left, upper right)
702702
self.bbox = _Array('d', unpack("<4d", shp.read(32)))
703703
# Elevation
704-
self.elevation = _Array('d', unpack("<2d", shp.read(16)))
704+
self.zbox = _Array('d', unpack("<2d", shp.read(16)))
705705
# Measure
706-
self.measure = []
706+
self.mbox = []
707707
for m in _Array('d', unpack("<2d", shp.read(16))):
708708
# Measure values less than -10e38 are nodata values according to the spec
709709
if m > NODATA:
710-
self.measure.append(m)
710+
self.mbox.append(m)
711711
else:
712-
self.measure.append(None)
712+
self.mbox.append(None)
713713

714714
def __shape(self):
715715
"""Returns the header info and geometry for a single shape."""

shapefile.pyc

-20 Bytes
Binary file not shown.

shapefiles/test/balancing.dbf

0 Bytes
Binary file not shown.

shapefiles/test/contextwriter.dbf

0 Bytes
Binary file not shown.

shapefiles/test/dtype.dbf

0 Bytes
Binary file not shown.

shapefiles/test/line.dbf

0 Bytes
Binary file not shown.

shapefiles/test/linem.dbf

0 Bytes
Binary file not shown.

shapefiles/test/linez.dbf

0 Bytes
Binary file not shown.

shapefiles/test/multipatch.dbf

0 Bytes
Binary file not shown.

shapefiles/test/multipoint.dbf

0 Bytes
Binary file not shown.

shapefiles/test/onlydbf.dbf

0 Bytes
Binary file not shown.

shapefiles/test/point.dbf

0 Bytes
Binary file not shown.

shapefiles/test/polygon.dbf

0 Bytes
Binary file not shown.

shapefiles/test/shapetype.dbf

0 Bytes
Binary file not shown.

shapefiles/test/testfile.dbf

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)