Reads SharedStreets Protobuf buffers.
In Node.js
$ yarn add sharedstreets-pbf
CommonJS
const sharedstreetsPbf = require('sharedstreets-pbf');
Typescript
import * as sharedstreetsPbf from 'sharedstreets-pbf';
For a full list of web examples, check out SharedStreets examples.
sharedstreets-pbf
uses submodules, make sure to include--recursive
when cloning the repo.
$ git clone --recursive [email protected]:sharedstreets/sharedstreets-pbf.git
$ cd sharedstreets-pbf
$ yarn
$ yarn build
$ yarn test
Geometry Pbf
Parser for SharedStreets Geometry Pbf Buffers
Parameters
buffer
Buffer Pbf Buffer
Examples
const buffer = fs.readFileSync('z-x-y.geometry.pbf')
const geoms = sharedstreetsPbf.geometry(buffer)
geoms[0].id // => '81f666c5e1e4de0f7df4fbd793d909b2'
Returns Array<SharedStreetsGeometry> An Array of SharedStreet Geometry
Intersection Pbf
Parser for SharedStreets Intersection Pbf Buffers
Parameters
buffer
Buffer Pbf Buffer
Examples
const buffer = fs.readFileSync('z-x-y.intersection.pbf')
const intersections = sharedstreetsPbf.intersection(buffer)
intersections[0].id // => '8037a9444353cd7dd3f58d9a436f2537'
Returns Array<SharedStreetsIntersection> An Array of SharedStreet Intersections
Reference Pbf
Parser for SharedStreets Reference Pbf Buffers
Parameters
buffer
Buffer Pbf Buffer
Examples
const buffer = fs.readFileSync('z-x-y.reference.pbf')
const references = sharedstreetsPbf.reference(buffer)
references[0].id // => '41d73e28819470745fa1f93dc46d82a9'
Returns Array<SharedStreetsReferencePbf> An Array of SharedStreet References
Metadata Pbf
Parser for SharedStreets Metadata Pbf Buffers
Parameters
buffer
Buffer Pbf Buffer
Examples
const buffer = fs.readFileSync('z-x-y.metadata.pbf')
const metadatas = sharedstreetsPbf.metadata(buffer)
metadatas[0].geometryID // => '81f666c5e1e4de0f7df4fbd793d909b2'
Returns Array<SharedStreetsMetadata> An Array of SharedStreet Metadatas
Decode Delimited buffers using protobufjs
Parameters
buffer
(Buffer | Uint8Array) Pbf Bufferparser
any Protobufjs Parser
Examples
const parser = sharedstreetsPbf.SharedStreetsProto.GISMetadata;
const results = sharedstreetsPbf.readBuffer(buffer, parser);
Returns Array<Object> An Array of based on given Protobufjs Parser