Properties are being removed from FeatureCollection
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
I have created a .pbf file, but when I decode it, all the properties are removed from each feature.
I used the Getools geobuf libraries to do this, encoded and decoded successfully, I am gzipping the outputsream,
File file = new File("/Projects/geobufs/test.pbf");
GeobufFeatureCollection geobufFeatureCollection = new GeobufFeatureCollection();
InputStream inputStream = new FileInputStream(file);
SimpleFeatureCollection decodedFeatureCollection = geobufFeatureCollection.decode(inputStream);
inputStream.close();
FeatureJSON fjson = new FeatureJSON(new GeometryJSON(DECIMALS));
StringWriter writer = new StringWriter();
fjson.writeFeatureCollection(decodedFeatureCollection, writer);
String geoJSON = writer.toString();
logger.info(geoJSON);
I download the file
var geobuffURL = "http://localhost:8080/geobuffer/test.pbf";
var oReq = new XMLHttpRequest();
oReq.open("GET", geobuffURL, true);
oReq.responseType = "arraybuffer";
oReq.onload = function(oEvent) {
var data = new Pbf(new Uint8Array(oReq.response))
console.log(data)
var geoJSON = geobuf.decode(data);
console.log(JSON.stringify(geoJSON));
//var layer = L.geoJson( geobuf.decode(data)).addTo(map);
}
oReq.send();
and it strips the properties from the geoJSON.
I am attaching both the geojson, and the pbf I encoded.
[test.files.zip](https://github.com/mapbox/geobuf/files/2670767/test.files.zip)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test.files.zip, especially the supplied GeoJSON and test.pbf, and trace the JavaScript geobuf.decode(data) entry point used in the browser example. Compare the original and decoded feature properties; done means decoding the attached PBF preserves those properties in the resulting GeoJSON.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100