SharedStreets PBF Parser
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
proto
scripts
sharedstreets-ref-system @ 03eba5a
test
.gitignore
.gitmodules
.travis.yml
CHANGELOG.md
LICENSE
README.md
bench.ts
index.ts
package.json
test.ts
tsconfig.json
tslint.json
yarn.lock

README.md

SharedStreets PBF Parser

npm version Build Status

Reads SharedStreets Protobuf buffers.

Install

In Node.js

$ yarn add sharedstreets-pbf

CommonJS

const sharedstreetsPbf = require('sharedstreets-pbf');

Typescript

import * as sharedstreetsPbf from 'sharedstreets-pbf';

In Browser

For a full list of web examples, check out SharedStreets examples.

How to build

sharedstreets-pbf uses submodules, make sure to include --recursive when cloning the repo.

$ git clone --recursive git@github.com:sharedstreets/sharedstreets-pbf.git
$ cd sharedstreets-pbf
$ yarn
$ yarn build
$ yarn test

API

Table of Contents

geometry

Geometry Pbf

Parser for SharedStreets Geometry Pbf Buffers

Parameters

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

Intersection Pbf

Parser for SharedStreets Intersection Pbf Buffers

Parameters

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

Reference Pbf

Parser for SharedStreets Reference Pbf Buffers

Parameters

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

Metadata Pbf

Parser for SharedStreets Metadata Pbf Buffers

Parameters

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

readBuffer

Decode Delimited buffers using protobufjs

Parameters

Examples

const parser = sharedstreetsPbf.SharedStreetsProto.GISMetadata;
const results = sharedstreetsPbf.readBuffer(buffer, parser);

Returns Array<Object> An Array of based on given Protobufjs Parser