Skip to content

Instantly share code, notes, and snippets.

@Spaxe
Created August 23, 2017 11:09
Show Gist options
  • Save Spaxe/f44a70e726b6eae13656f7ac7579de67 to your computer and use it in GitHub Desktop.
Save Spaxe/f44a70e726b6eae13656f7ac7579de67 to your computer and use it in GitHub Desktop.
This version works
<!DOCTYPE html>
<html>
<body>
<script src="https://unpkg.com/geobuf@3.0.0/dist/geobuf.js"></script>
<script src="https://unpkg.com/pbf@3.0.5/dist/pbf.js"></script>
<script>
const data = {
"type": "FeatureCollection",
"features": [
{
"geometry": {
"coordinates": [
[
[
138.674968,
-34.811527
],
[
138.674792,
-34.811596
]
]
],
"type": "MultiLineString"
},
"properties": {
"id": 1,
},
"type": "Feature"
}
]
};
</script>
<script>
const encoded = geobuf.encode(data, new Pbf());
console.log(encoded);
const buf = new Pbf(encoded);
console.log(buf);
const geojson = geobuf.decode(buf);
console.log(geojson); // <- seems to work
</script>
</body>
</html>
@qxang
Copy link

qxang commented Oct 19, 2017

Unimplemented type: 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment