Closed shawel closed 6 years ago
I don't think geobuf
should support environments with custom Object.prototype
properties. Most JS libraries will break with things like this. It has been one of the biggest antipatterns in JS for at least 10 years.
Specifically geoJSON properties are not encoded properly and the fields return null values. Additionally the geometry attribute is also polluted with fields that should be in properties. Tested on feature collection see https://jsfiddle.net/9wm2qn2m/
The following gives an invalid geoJSON output. // any function Object.prototype.mycustomobjectfunction = function(){
}
var togeobuf = geobuf.encode(geojson, new Pbf()) var togeojson = geobuf.decode(new Pbf(togeobuf)) console.log(togeojson)
Example of error output
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-73.916016,40.737305],[-73.916016,40.693359],[-73.87207,40.693359],[-73.87207,40.737305],[-73.916016,40.737305]]],"fill":null},"properties":{"fill":null}