Comments (6)
Looks like browserify can't include bytebuffer
correctly. I see this in the final osm-read-pbf.js
:
{"bytebuffer":"bytebuffer","fs":undefined,"path":undefined}]}
from osm-read.
Seems like my hack to include the minified files is no longer working with the latest browserify:
browserify ./lib/pbfParser.js --bare -x bytebuffer -x long -r ./node_modules/protobufjs/node_modules/bytebuffer/ByteBuffer.min.js:bytebuffer -r ./node_modules/protobufjs/node_modules/bytebuffer/node_modules/long/dist/Long.min.js:long -s=pbfParser -o osm-read-pbf.js
As a workaround you can use:
browserify ./lib/pbfParser.js --bare -s=pbfParser -o osm-read-pbf.js
Need to see what I can do about this.
from osm-read.
Thanks! The workaround works for now.
BTW: This is an amazing project and I'm looking forward to see OSM data in Node and the browser…
from osm-read.
The reason for wanting to require the already minified files is that ByteBuffer.min.js
and Long.min.js
are built with Google Closure Compiler in advanced mode, which supposedly might also improve runtime performance e.g. by function inlining.
But now I have done some quick manual testing and could not observe a significant performance improvement. I also wanted to look into compiling across all modules instead of using the individual builds, but don't know if that would be worth the effort. So for now I'm simply using minifyify on the sources.
Here is the build workaround used for testing:
browserify -r ./node_modules/protobufjs/node_modules/bytebuffer/dist/ByteBufferAB.min.js:bytebuffer -x long -o bytebuffer.js
browserify -r ./node_modules/protobufjs/node_modules/bytebuffer/node_modules/long/dist/Long.min.js:long -o long.js
browserify ./lib/pbfParser.js --bare -x bytebuffer -x long -s=pbfParser -o osm-read-pbf.js
<script src="long.js"></script>
<script src="bytebuffer.js"></script>
<script src="osm-read-pbf.js"></script>
from osm-read.
I did follow your workaround so far,
but I end up with:
Uncaught TypeError: Cannot read property 'decode' of undefined (in osm-read-pbf.js):
function readBlobHeaderContent(fd, position, size, callback) {
=> return reader.readPBFElement(fd, position, size, fileFormat.BlobHeader.decode, callback);
}
Looks like:
var fileFormat = require('./proto/fileformat.js');
does'nt instantiate correctly ... (i.e. missing Member '.BlobHeader')
Would you please upload (e.g. to './dist') any working files from your functional workaround:
long.js, bytebuffer.js, osm-read-pbf.js
so I can check against my configuration ...
PLEASE ... ;-)
Thank you.
from osm-read.
Sorry about this. Moving forward, I now have merged the pending PR #31. This fixes the build, so npm run browserify
now works again.
I also have committed the osm-read-pbf.js
to the repo. It contains all that is needed, so you should be ready to go.
from osm-read.
Related Issues (20)
- lat lon are not in WSG84 format HOT 5
- Relations HOT 2
- Relation members output format HOT 6
- number instead of string for id, uid and ref? HOT 3
- Pause/Resume HOT 12
- Parser getting stuck HOT 1
- Cannot read property 'byteLength' of undefined HOT 5
- Too Much Recursion HOT 4
- Get tag "center" from overpass-api response xml HOT 2
- Invalid typed array length in arrayBufferReader Line 12 HOT 1
- Allocation failed - process out of memory HOT 1
- Tags unresolved HOT 3
- Vulnerability in protobuf dependencies HOT 2
- pbfParser in node.js and "TypeError: Invalid non-string/buffer chunk" HOT 9
- Is it possible to do any progress indication HOT 1
- Module not found: Error: Can't resolve '../../node_modules/zlibjs/bin/inflate.min.js' HOT 1
- Would exposing an async iterator API suit this library? HOT 3
- Why not store IDs as BigInt? HOT 4
- primitivegroup.length - Is it always 1? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osm-read.