Skip to content

Commit 13fc029

Browse files
committed
Specifically document the deletionflag
Fixes #241
1 parent b838e9a commit 13fc029

16 files changed

+11
-1
lines changed

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,16 @@ attribute:
542542
... ["UNITS3_9", "N", 8, 0], ["UNITS10_49", "N", 8, 0],
543543
... ["UNITS50_UP", "N", 8, 0], ["MOBILEHOME", "N", 7, 0]]
544544

545+
The first field of a dbf file is always a 1-byte field called "DeletionFlag",
546+
which indicates records that have been deleted but not removed. However,
547+
since this flag is very rarely used, PyShp currently will return all records
548+
regardless of their deletion flag, and the flag is also not included in the list of
549+
record values. In other words, the DeletionFlag field has no real purpose, and
550+
should in most cases be ignored. For instance, to get a list of all fieldnames:
551+
552+
553+
>>> fieldnames = [f[0] for f in sf.fields[1:]]
554+
545555
You can get a list of the shapefile's records by calling the records() method:
546556

547557

@@ -556,7 +566,7 @@ To read a single record call the record() method with the record's index:
556566
>>> rec = sf.record(3)
557567

558568
Each record is a list-like Record object containing the values corresponding to each field in
559-
the field list. A record's values can be accessed by positional indexing or slicing.
569+
the field list (except the DeletionFlag). A record's values can be accessed by positional indexing or slicing.
560570
For example in the blockgroups shapefile the 2nd and 3rd fields are the blockgroup id
561571
and the 1990 population count of that San Francisco blockgroup:
562572

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/edit.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/merge.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)