GithubHelp home page GithubHelp logo

youssef-harby / arcgis-pbf-parser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rowanwins/arcgis-pbf-parser

1.0 0.0 0.0 344 KB

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

License: Apache License 2.0

JavaScript 100.00%

arcgis-pbf-parser's Introduction

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.

Test Status minzipped size

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 object, 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
}

Status

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

Done

  • Polgon
    • Inc MultiPolygon
    • Inc Polygon with holes
  • LineString
    • Inc MultiLineString
  • Point
  • Attributes
  • Features with null geometries

To Do

  • MultiPoint (a sample service would be helpful)
  • Improve 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.

arcgis-pbf-parser's People

Contributors

rowanwins avatar vancehu avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.