Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties are being removed from FeatureCollection #102

Open
mrisney opened this issue Dec 12, 2018 · 1 comment
Open

Properties are being removed from FeatureCollection #102

mrisney opened this issue Dec 12, 2018 · 1 comment
Labels

Comments

@mrisney
Copy link

mrisney commented Dec 12, 2018

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

@avatarneil
Copy link

I'm running into this issue as well. Happy to take a look and pop open a PR if the maintainers would like!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants