Skip to content
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

Expose featureCount property. Fixes #40. #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ Calling [shapefile.open](#open) yields a *source*; you can then call [*source*.r

The shapefile’s bounding box [*xmin*, *ymin*, *xmax*, *ymax*], where *x* and *y* represent longitude and latitude in spherical coordinates. This field is only defined on sources returned by [shapefile.open](#open) and [shapefile.openShp](#openShp), not [shapefile.openDbf](#openDbf).

<a name="source_size" href="#source_size">#</a> <i>source</i>.<b>size</b>

The number of features present, determined by looking at the header of the .dbf file. This field is only defined on sources returned by [shapefile.open](#open) and [shapefile.openDbf](#openDbf), not [shapefile.openShp](#openShp).

<a name="source_read" href="#source_read">#</a> <i>source</i>.<b>read</b>() [<>](https://github.com/mbostock/shapefile/blob/master/shapefile/read.js "Source")

Returns a Promise for the next record from the underlying stream. The yielded result is an object with the following properties:
Expand Down
1 change: 1 addition & 0 deletions dbf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function Dbf(source, decoder, head, body) {
this._source = source;
this._decode = decoder.decode.bind(decoder);
this._recordLength = head.getUint16(10, true);
this.size = head.getUint16(4, true);
this._fields = [];
for (var n = 0; body.getUint8(n) !== 0x0d; n += 32) {
for (var j = 0; j < 11; ++j) if (body.getUint8(n + j) === 0) break;
Expand Down
1 change: 1 addition & 0 deletions shapefile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function Shapefile(shp, dbf) {
this._shp = shp;
this._dbf = dbf;
this.bbox = shp.bbox;
this.size = dbf && dbf.size;
}

var prototype = Shapefile.prototype;
Expand Down