Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arcgis-pbf-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arcgis-pbf-parser

A library for parsing the arcgis pbf format into geojson

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

arcgis-pbf-parser

A library for converting an arcgis-pbf into a geojson FeatureCollection.

By itself it doesn't do much but you can find a more complex example of it's usage is in my mapbox-gl-arcgis-featureserver library.

Basic Usage

const arcgisPbfDecode = require('arcgis-pbf-parser')
// or in ES6
import arcgisPbfDecode from' arcgis-pbf-parser'

fetch('Some/FeatureServer/0/query?f=pbf&...')
  .then(response => response.arrayBuffer())
  .then(data => {
    const featureCollection = arcgisPbfDecode(new Uint8Array(data)).featureCollection
   })

The decode method returns an object containing the featureCollection, and a boolean specifying if there were too many features and so you need to paginate for more features with the same request.

{
  featureCollection: {
    ...
  },
  exceededTransferLimit: true/false
}

Note I've not bundled the pbf dependency in my package, so you may need to npm install pbf --save in your project, although many of the common mapping libraries already include it so 🤞 you shouldn't need to.

Status

This was cobbled together fairly quickly based on the minimal documentation available.

Done

  • Polgon
    • Inc MultiPolygon
    • Inc Polygon with holes
  • LineString
  • Point
  • Attributes

To Do

  • MultiPoint (a sample service would be helpful)
  • MultiLineString (a sample service would be helpful)
  • Write proper tests

Acknowledgements

  • I used the proto spec file supplied by Esri here
  • I used the mapbox pbf library to compile the src/parser/PbfFeatureCollection.js module for parsing rather than the one supplied by Esri
    • This results in a slimmer & faster package and the pbf dependency will be shared/tree-shaken with mapbox-gl.

FAQs

Package last updated on 20 Jul 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc