{"name":"geobuf","version":"4.0.0","description":"Compact binary encoding for geographic data","type":"module","main":"index.js","bin":{"geobuf2json":"bin/geobuf2json.js","json2geobuf":"bin/json2geobuf.js","shp2geobuf":"bin/shp2geobuf.js"},"scripts":{"pretest":"eslint *.js test/*.js bin/*.js","test":"node --test","build":"rolldown -c","prepublishOnly":"npm test && npm run build"},"repository":{"type":"git","url":"git+ssh://git@github.com/mapbox/geobuf.git"},"keywords":["geographic","data","buffer","protobuf","format","compression","geojson","topojson"],"license":"ISC","bugs":{"url":"https://github.com/mapbox/geobuf/issues"},"homepage":"https://github.com/mapbox/geobuf","devDependencies":{"@mapbox/geojson-fixtures":"^2.0.0","benchmark":"~2.1.4","eslint":"^10.2.1","eslint-config-mourner":"^4.1.0","rolldown":"^1.0.0-rc.17"},"dependencies":{"pbf":"^4.0.1","shapefile":"~0.6.6"},"_id":"geobuf@4.0.0","gitHead":"b89ca0ea410c0172b67cf4738eb64b138f2b7301","_nodeVersion":"20.15.1","_npmVersion":"11.3.0","dist":{"integrity":"sha512-NEQaKkUKIbsY8FYH0oI1trGaH64Hj8d7CKyUWeDeM5q+xVDt1sfRXC3xyFLW9hsR54PS/NyxlH6i0okIcf67Sg==","shasum":"dd9ecd80c59a677962a9619a812961d47f03f2e6","tarball":"http://registry-npm.ywwl.com/geobuf/download/geobuf-4.0.0.tgz","fileCount":13,"unpackedSize":57700,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICCpkTZTa9eI/J9w5Qfy+MyWIz//jiu9XHT8MU6rbCE6AiAkwsT8oRt+MeRBqsl4BztkqtxBcJDatKbVlOub7vBEFw=="}],"size":13883,"noattachment":false,"key":"/geobuf/-/geobuf-4.0.0.tgz"},"_npmUser":{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},"directories":{},"maintainers":[{"name":"mapbox-npm-01","email":"accounts+npmjs-01@mapbox.com"},{"name":"mapbox-npm-02","email":"accounts+npmjs-02@mapbox.com"},{"name":"mapbox-npm-07","email":"accounts+npmjs-07@mapbox.com"},{"name":"mapbox-npm-03","email":"accounts+npmjs-03@mapbox.com"},{"name":"mapbox-npm-04","email":"accounts+npmjs-04@mapbox.com"},{"name":"mapbox-npm-09","email":"accounts+npmjs-09@mapbox.com"},{"name":"mapbox-npm-05","email":"accounts+npmjs-05@mapbox.com"},{"name":"mapbox-npm-06","email":"accounts+npmjs-06@mapbox.com"},{"name":"mapbox-npm-08","email":"accounts+npmjs-08@mapbox.com"},{"name":"mapbox-npm-advanced-actions","email":"accounts+npmjs-advanced-actions@mapbox.com"},{"name":"mapbox-npm-ci","email":"accounts+npmjs-npm-ci@mapbox.com"},{"name":"mapbox-npm","email":"accounts+npmjs@mapbox.com"},{"name":"mapbox-admin","email":"accounts@mapbox.com"},{"name":"mapbox-machine-user","email":"accounts+npm-mapbox-machine-user@mapbox.com"},{"name":"mbx-npm-ci-staging","email":"yannick.meeus+npm+staging+ci@mapbox.com"},{"name":"mbx-npm-ci-production","email":"yannick.meeus+npm+production+ci@mapbox.com"},{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},{"name":"mbx-npm-02-production","email":"yannick.meeus+npm+prod+02@mapbox.com"},{"name":"mbx-npm-03-production","email":"yannick.meeus+npm+prod+03@mapbox.com"},{"name":"mbx-npm-04-production","email":"yannick.meeus+npm+prod+04@mapbox.com"},{"name":"mbx-npm-05-production","email":"yannick.meeus+npm+prod+05@mapbox.com"},{"name":"mbx-npm-06-production","email":"yannick.meeus+npm+prod+06@mapbox.com"},{"name":"mbx-npm-07-production","email":"yannick.meeus+npm+prod+07@mapbox.com"},{"name":"mbx-npm-08-production","email":"yannick.meeus+npm+prod+08@mapbox.com"},{"name":"mbx-npm-09-production","email":"yannick.meeus+npm+prod+09@mapbox.com"},{"name":"mbx-npm-02-staging","email":"yannick.meeus@mapbox.com"},{"name":"mbx-npm-advanced-actions-staging","email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com"},{"name":"mbx-npm-advanced-actions-production","email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/geobuf_4.0.0_1777385051018_0.215580439005727"},"_hasShrinkwrap":false,"readme":"# Geobuf\n\nGeobuf is a compact binary encoding for geographic data.\n\nGeobuf provides _nearly lossless_ compression of GeoJSON data\ninto [protocol buffers](https://developers.google.com/protocol-buffers/).\nAdvantages over using GeoJSON alone:\n\n- **Very compact**: typically makes GeoJSON 6-8 times smaller.\n- 2-2.5x smaller even when comparing gzipped sizes.\n- **Very fast encoding and decoding** &mdash; even faster than native JSON parse/stringify.\n- Can accommodate any GeoJSON data, including extensions with arbitrary properties.\n\nThe [encoding format](geobuf.proto) also potentially allows:\n\n- Easy **incremental parsing** &mdash; get features out as you read them,\nwithout the need to build in-memory representation of the whole data.\n- **Partial reads** &mdash; read only the parts you actually need, skipping the rest.\n\nThink of this as an attempt to design a simple, modern Shapefile successor\nthat works seamlessly with GeoJSON.\nUnlike [Mapbox Vector Tiles](https://github.com/mapbox/vector-tile-spec/),\nit aims for nearly lossless compression of datasets &mdash; without tiling, projecting coordinates,\nflattening geometries or stripping properties.\n\nNote that the encoding schema is **not stable yet** &mdash;\nit may still change as we get community feedback and discover new ways to improve it.\n\n\"Nearly\" lossless means coordinates are encoded with precision of 6 digits after the decimal point (about 10cm).\n\n\n#### Sample compression sizes\n\nData                | JSON      | JSON (gz) | Geobuf   | Geobuf (gz)\n------------------- | --------: | --------: | -------: | ----------:\nUS zip codes        | 101.85 MB | 26.67 MB  | 12.24 MB | 10.48 MB\nIdaho counties      | 10.92 MB  | 2.57 MB   | 1.37 MB  | 1.17 MB\n\n## API\n\n### encode\n\n```js\nconst buffer = geobuf.encode(geojson, new Pbf());\n```\n\nGiven a GeoJSON object and a [Pbf](https://github.com/mapbox/pbf) object to write to,\nreturns a Geobuf as `UInt8Array` array of bytes.\nIn Node@4.5.0 or later, you can use `Buffer.from` to convert back to a buffer.\n\n### decode\n\n```js\nconst geojson = geobuf.decode(new Pbf(data));\n```\n\nGiven a [Pbf](https://github.com/mapbox/pbf) object with Geobuf data, return a GeoJSON object. When loading Geobuf data over `XMLHttpRequest`, you need to set `responseType` to [`arraybuffer`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).\n\n\n## Install\n\n```bash\nnpm install geobuf\n```\n\nBrowser build CDN links:\n\n- https://unpkg.com/geobuf@3.0.2/dist/geobuf.js\n- https://unpkg.com/geobuf@3.0.2/dist/geobuf-dev.js\n\nBuilding locally:\n\n```bash\nnpm run build\n```\n\n\n## Command Line\n\n```bash\nnpm install -g geobuf\n```\n\nInstalls these nifty binaries:\n\n* `geobuf2json`: turn Geobuf from `stdin` or specified file to GeoJSON on `stdout`\n* `json2geobuf`: turn GeoJSON from `stdin` or specified file to Geobuf on `stdout`\n* `shp2geobuf`: given a Shapefile filename, send Geobuf on `stdout`\n\n```bash\njson2geobuf data.json > data.pbf\nshp2geobuf myshapefile > data.pbf\ngeobuf2json data.pbf > data.json\n```\n\nNote that for big files, `geobuf2json` command can be pretty slow, but the bottleneck is not the decoding,\nbut the native `JSON.stringify` on the decoded object to pipe it as a string to `stdout`.\nOn some files, this step may take 40 times more time than actual decoding.\n\n\n## See Also\n\n* [geojsonp](https://github.com/springmeyer/geojsonp) &mdash; the prototype that led to this project\n* [pygeobuf](https://github.com/pygeobuf/pygeobuf) &mdash; Python implementation of Geobuf\n* [twkb](https://github.com/TWKB/Specification) &mdash; a geospatial binary encoding that doesn't support topology\nand doesn't encode any non-geographic properties besides `id`\n* [vector-tile-spec](https://github.com/mapbox/vector-tile-spec)\n* [topojson](https://github.com/mbostock/topojson) &mdash; an extension of GeoJSON that supports topology\n* [WKT and WKB](https://en.wikipedia.org/wiki/Well-known_text) &mdash; popular in databases\n* [EWKB](http://postgis.refractions.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT) &mdash; a popular superset of WKB\n","publish_time":1777385051204,"_cnpm_publish_time":1777385051204,"dist-tags":{"latest":"4.0.0"}}