bahung1221 / dart-vector-tile

A simple Dart package to encode & decode Mapbox Vector Tile
https://pub.dev/packages/vector_tile
MIT License
15 stars 10 forks source link

Failing to decode tiles with: Protocol message tag had invalid wire type. #16

Open Sprechen opened 1 month ago

Sprechen commented 1 month ago

Hi guys,

I'm trying to decode a tiles in pbf format, that I know I can correctly visualize using Mapbox/MapLibre. I need to compare to different tiles and merge them (they come from the margin of two different mbtiles). Unfortunately, I encountered this problem.

Here is the base64 version of the tile data:

H4sIAAAAAAACAz2NQWrCUBRF33//Jfn3xiL+VJDgoBUHzgpdQXciKckgkFrRKO2kdDniSlyRYw2FTs4dnXPLi/tShvfPw6audt+r36cyr+qPdrPummPTlaFu99tD39SLZCoib38j8Wem0UScW/S4Lq+RoUD2SH0FAi1AHuhTWEJzUKVzKEZ0gucJI5EGpoqXMaPH6u4qck8VZCnNY5xRDWb0HgwUh3k+cDoaaEMtxv//gPPyVNy9GwgrPffLAAAA
bahung1221 commented 1 month ago
Unfortunately, I encountered this problem.

Do you have any error message or screenshot?

Sprechen commented 1 month ago

@bahung1221 digging in the code, the error seems caused be the line 80 of the file unknown_field_set.dart of the protobuffer library, that throws the exception InvalidProtocolBufferException.invalidWireType(). I've tried to comment that line and the parsing "seems" to work, but that quite strange

bahung1221 commented 1 month ago

After a quick search, it seems this error is related to the corruption of protobuf file (pbf), it is hard for me since my pbf files for testing are still working, so can you try the other pdf files to see if it work? I have some sample files here: https://github.com/bahung1221/dart-vector-tile/tree/master/example/data

Maybe I will try your pbf file tonight, but not sure if there is anything that I can do 😄

Sprechen commented 1 month ago

@bahung1221 well, I understand your point and I also agree with you that the problem seems more about a corruption of the file itself (they are profobuffer encoded, so the decode/encode code is generated starting from the definition itself). On the other hand, these pbf tiles are encoded into an mbtiles file, and they are used by maplibre without any problem, so it seems quite strage... I was expecting to decode and compare them without any problem, also in dart