Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rowanwins/arcgis-pbf-parser
A library for converting an arcgis-pbf into a geojson FeatureCollection.
https://github.com/rowanwins/arcgis-pbf-parser
arcgis esri pbf
Last synced: 11 days ago
JSON representation
A library for converting an arcgis-pbf into a geojson FeatureCollection.
- Host: GitHub
- URL: https://github.com/rowanwins/arcgis-pbf-parser
- Owner: rowanwins
- License: apache-2.0
- Created: 2021-06-16T03:10:53.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-14T04:47:24.000Z (over 1 year ago)
- Last Synced: 2024-10-22T08:53:12.465Z (17 days ago)
- Topics: arcgis, esri, pbf
- Language: JavaScript
- Homepage:
- Size: 336 KB
- Stars: 22
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# arcgis-pbf-parser
A library for converting an [arcgis-pbf](https://github.com/Esri/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](https://github.com/rowanwins/mapbox-gl-arcgis-featureserver) library.
[![Test Status](https://github.com/rowanwins/arcgis-pbf-parser/workflows/Tests/badge.svg?branch=master)](https://github.com/rowanwins/arcgis-pbf-parser/actions)
[![minzipped size](https://badgen.net/bundlephobia/minzip/arcgis-pbf-parser)](https://esm.run/arcgis-pbf-parser)## 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](https://github.com/Esri/arcgis-pbf/tree/main/proto/FeatureCollection) 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](https://github.com/Esri/arcgis-pbf/blob/main/proto/FeatureCollection/FeatureCollection.proto)
- I used the mapbox `pbf` [library](https://github.com/mapbox/pbf) to compile the `src/parser/PbfFeatureCollection.js` module for parsing rather than the [one supplied](https://github.com/Esri/arcgis-pbf/blob/main/proto/FeatureCollection/parsers/js/FeatureCollection.js) by Esri
- This results in a slimmer & faster package and the `pbf` dependency will be shared/tree-shaken with mapbox-gl.