mapbox / dbf Goto Github PK
View Code? Open in Web Editor NEWdbf writer
License: BSD 2-Clause "Simplified" License
dbf writer
License: BSD 2-Clause "Simplified" License
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/dbf/src/structure.js b/node_modules/dbf/src/structure.js
index 4b02783..f2b4c0b 100644
--- a/node_modules/dbf/src/structure.js
+++ b/node_modules/dbf/src/structure.js
@@ -55,7 +55,7 @@ module.exports = function structure(data, meta) {
if (f.type == 'N') view.setInt8(32 + i * 32 + 17, 3);
});
- offset = fieldDescLength + 32;
+ var offset = fieldDescLength + 32;
data.forEach(function(row, num) {
// delete flag: this is not deleted
This issue body was partially generated by patch-package.
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/dbf/src/structure.js b/node_modules/dbf/src/structure.js
index 4b02783..f2b4c0b 100644
--- a/node_modules/dbf/src/structure.js
+++ b/node_modules/dbf/src/structure.js
@@ -55,7 +55,7 @@ module.exports = function structure(data, meta) {
if (f.type == 'N') view.setInt8(32 + i * 32 + 17, 3);
});
- offset = fieldDescLength + 32;
+ var offset = fieldDescLength + 32;
data.forEach(function(row, num) {
// delete flag: this is not deleted
This issue body was partially generated by patch-package.
I'm get the error 'offset' is not defined because I use strict mode. I saw that code is fixed for it but still not published it because whenever I'm download npm package "npm i dbf". I'm able to reproduce this issue and found that the code is not updated in npm package side. Still "var" is missing in line number 58
Hi.
Is it possible to append data (instead of replacing the old file) to an existing DBF file? I tried to use fs methods such appendFileSync or writeSync instead of writeFileSync; and the file updates its date and size, but I can't see new data... only the first registers I added using writeSync.
Thank you very much.
when i open the dbf file, ithe chinese character is messy code, how to solve the problem? thank you
It's possible but a little zany to implement this with streams rather than pre-allocating buffers
Hi @Countdown369, Thanks for updating the version in the package.json. When we can expect this version will be published in npm packages?
Line 3 in abbdad2
Hi,
Thanks for your tool. Perhaps I am wrong, but I think the field headers should allow up to 10 characters. I try to export with such but I get headers truncated at 8
How do I save the dbf file on the browser?
I'm working on a project that allows export of drawn geometries as shapefile and import of shapefiles for presentation on the map.
Right now I'm trying to implement the workflow when you can draw a feature, export it as shapefile, drag'n'drop it on the page again and it will be imported.
For shapefile export I'm using shp-write library, which is dependent on your lib, and shapefile-js for import. When the latter is trying to parse dbf file created by your library, I receive "Offset is outside the bounds of the DataView" in latest Chrome (there must be at least one property present for the feature in geojson, but it's another bug).
I have tried to open exported shapefile in QGIS and save it again, then shapefile-js library has no troubles parsing the created dbf. So I guess there's some difference between the dbf created by javascript vs. dbf created by QGIS. Any ideas where the bug might be?
Hi, I'm thinking on migrate my vfp based invoice system into electron and I saw that you need help.
What can I help with?
Because offset is not declared with var
in structure.js, this package breaks if you try to bundle it with something like rollup and you have 'use strict'
. The workaround is that you can tell rollup to not 'use strict'
but it's probably better that variables are declared.
@davidtheclark Open to maintaining, please reach out
i'm get the error 'offset' is not defined because i use strict mode.
so the fix for this kind of issue is to change
in dbf/src/structure.js
(line number 58)
from:
offset = fieldDescLength + 32;
to:
var offset = fieldDescLength + 32;
I have used this node and works well except for any file exported in the month of January. When trying to import the dbf into Word perfect, the file is reported to be of an unsupported format. Upon review of the DBF file header, the Last Modified Date for the month of January shows a value of "00" and February is "01", etc...
Standard applications such as Excel and Quattro certainly don't care about the file header but Word Perfect seems to and throws a file format error. I have attached 2 screenshots of the said error. 1 was created Jan 2018 and the other in Feb 2017 for reference.
If a column has only null values we cant calc the size for the buffer.
So i think a fallback to String
would be fine.
Example:
function obj(_) {
var fields = {}, o = [];
for (var p in _) fields[p] = typeof _[p];
for (var n in fields) {
var t = types[fields[n]];
o.push({
name: n,
type: t || 'C',
size: fieldSize[t] || fieldSize['C']
});
}
return o;
}
when i use this lib to save data which contains chinese character, it works. But when i open the dbf file, the character is mess. How can i solve this problem. Thank u.
Via: mapbox/shp-write#38
Hi, don't you want to convert this to reusable jBinary structure so I could include this into jBinary.Repo file format collection?
README has a link to https://unpkg.com/dbf@latest/dbf.js , but the repo only includes node examples. Is there a browser example? GitHub pages could be used to host the web example
Hi
I am having issues with the DBF file created using this code. It is read perfectly by https://www.dbfopener.com/
but when I check in QGIS only 1 row shows.
Importing the SHP into google earth pro works (as in the info window shows all the data that is in the dbf table).
SHP, DBF, etc in the attached zip file
Any ideas?
ShapeExport (3).zip
Can just substitute more math for the complexity/performance hit.
Would it be possible to have javascript date
support? From the source of structure.js
it looks like it is at least partially supported, but is there anything blocking having the fields.js
script resolve date
types in addition to number
s, string
s, and boolean
s?
Willing to submit a PR, but didn't want to waste my time if it wasn't possible/desired.
Currently figuring out a post exporting issue in arcMap and up to maintaining this project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.