Parsing Mapillary PBF tiles?

When I use the “Coverage Tiles” API, I get a PBF file returned. If I upload this PBF file to mygeodata.cloud, it can return me a JSON with the data that I’m expecting, but I’d like to be able to parse it myself; ideally in C#, but I’d settle for anything that I can call from the command line if necessary.

There’s no shortage of libraries out there that talk about being able to parse PBF files, but they mostly seem to be targeting other platforms like OSM; the few that I’ve tried, when I pass in a PBF returned from the Mapillary API, they just error out. Does anyone have any experience getting this working in practice?

What kind of errors do you get? There are libraries for working with vector tiles available for all languages, here’s one example for C#: GitHub - NetTopologySuite/NetTopologySuite.IO.VectorTiles: A package that can be used to generate vector tiles using NTS.

For example, when I try Mapbox’s “vector-tile-cs” library, I get the message “Exception: unknown wire type”.

NetTopologySuite looks promising, but unfortunately I’m trying to work in Unity, so installing NuGet packages doesn’t really work right; I got pretty far just adding the source to the project manually, but I can’t figure out what Protobuf library it’s using (the Google.Protobuf one seemed to not be what it’s looking for, and the Protobuf-net one seems to be too new to work with this older Unity project…)

Sorry to bump an old thread, but in case anybody else runs into this problem: it turns out it was because the data that I was getting back from the request wasn’t a PBF file at all: API returns "Update Your Browser" instead of PBF files, for some clients?

1 Like