Skip to content
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
5 changes: 4 additions & 1 deletion dbf/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default function() {
var that = this, i = 1;
return that._source.slice(that._recordLength).then(function(value) {
return value && (value[0] !== 0x1a) ? {done: false, value: that._fields.reduce(function(p, f) {
p[f.name] = types[f.type](that._decode(value.subarray(i, i += f.length)));
var v = value.subarray(i, i += f.length);
var j = v.indexOf(0);
Comment on lines +20 to +21
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var v = value.subarray(i, i += f.length);
var j = v.indexOf(0);
var v = value.subarray(i, i += f.length), j = v.indexOf(0);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

if (j > -1) v = v.subarray(0, j);
p[f.name] = types[f.type](that._decode(v), "");
return p;
}, {})} : {done: true, value: undefined};
});
Expand Down
1 change: 1 addition & 0 deletions test/Congress22.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UTF-8
Binary file added test/Congress22.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions test/Congress22.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/Congress22.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PROJCS["NAD_1983_UTM_Zone_18N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-75.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
Binary file added test/Congress22.sbn
Binary file not shown.
Binary file added test/Congress22.sbx
Binary file not shown.
Binary file added test/Congress22.shp
Binary file not shown.
2 changes: 2 additions & 0 deletions test/Congress22.shp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata xml:lang="en"><Esri><CreaDate>20220202</CreaDate><CreaTime>14235200</CreaTime><ArcGISFormat>1.0</ArcGISFormat><SyncOnce>TRUE</SyncOnce><DataProperties><lineage><Process ToolSource="c:\program files (x86)\arcgis\desktop10.8\ArcToolbox\Toolboxes\Data Management Tools.tbx\Dissolve" Date="20220202" Time="142307">Dissolve trblk "C:\Users\Eric Wienckowski\Documents\ArcGIS\Default.gdb\trblk_Dissolve5" Congress_020222.DISTRICT # MULTI_PART DISSOLVE_LINES</Process></lineage></DataProperties></Esri></metadata>
Binary file added test/Congress22.shx
Binary file not shown.
1 change: 1 addition & 0 deletions test/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var fs = require("fs"),
tape = require("tape"),
shapefile = require("../");

testConversion("Congress22");
testConversion("empty");
testConversion("boolean-property");
testConversion("number-property");
Expand Down