I want to convert the data in pbf format obtained by ajax into osm format (xml) data in the browser.
Try using the pbf library of mapbox, but it didn't work. I'm not sure if there is a problem with my usage.
I tried to use the pbf library of mapbox, but I don't quite understand how its api is called. In the end, I didn't convert the obtained binary format data into osm format data.
xhr.onreadystatechange = function (e) {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log("ok");
var pbf = new Pbf(new Uint8Array(xhr.response));
let i = 0,
len = pbf.length;
while (pbf.pos < len) {
console.log(pbf.pos);
console.log(pbf.readString());
}
}
};
If someone has good suggestions or methods, I hope I can exchange them.