New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

topobuf

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

topobuf

Compact binary encoding for topojson data

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Topobuf

Build Status

Topobuf is a compact binary encoding for topographic data.

Topobuf provides lossless1 compression of TopoJSON data into protocol buffers. Advantages over using JSON-based formats alone:

  • Very compact: typically makes TopoJSON 2-3 times smaller.
  • Smaller even when comparing gzipped sizes: 20-30% for TopoJSON.
  • Can store topology objects too large for JSON.stringify / JSON.parse
  • Can accommodate any TopoJSON data, including extensions with arbitrary properties.

Sample compression sizes

normalgzipped
pa-census-blocks.json280 MB44 MB
pa-census-blocks.pbf114 MB35 MB
us-zips.json15.02 MB3.19 MB
us-zips.pbf4.85 MB2.72 MB
idaho.json1.9 MB612 KB
idaho.pbf567 KB479 KB

Install

npm install topobuf

API

encode

var buffer = topobuf.encode(topojson, new Pbf());

Given a TopoJSON object and a Pbf object to write to, returns a Topobuf as a Buffer object in Node or UInt8Array object in browsers.

decode

var topojson = topobuf.decode(new Pbf(data));

Given a Pbf object with topobuf data, return a TopoJSON object.

See more

This library is based on geobuf by Mapbox, which provides similar functionality for GeoJSON

Footnotes

Keywords

geographic

FAQs

Package last updated on 23 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts