tilezen / mapbox-vector-tile

Python package for encoding & decoding Mapbox Vector Tiles
MIT License
240 stars 47 forks source link

How do I encode a decoded mvt? #130

Open Learningbug04 opened 1 year ago

Learningbug04 commented 1 year ago

I want to modify a part of the properties on the decoded tile and re-encode it. for example decoded_tile = mapbox_vector_tile.decode(b'\x1aJ\n\x05water\x12\x1a\x08\x01\x12\x06\x00\x00\x01\x01\x02\x02\x18\x03"\x0c\t\x00\x80@\x1a\x00\x01\x02\x00\x00\x02\x0f\x1a\x03foo\x1a\x03uid\x1a\x03cat"\x05\n\x03bar"\x02 {"\x06\n\x04flew(\x80 x\x02\x1aY\n\x03air\x12\x1c\x08\x01\x12\x08\x00\x00\x01\x01\x02\x02\x03\x03\x18\x03"\x0c\t\x00\x80@\x1a\x00\x01\x02\x00\x00\x02\x0f\x1a\x03foo\x1a\x03uid\x1a\x05balls\x1a\x03cat"\x05\n\x03bar"\x03 \xd2\t"\x05\n\x03foo"\x06\n\x04flew(\x80 x\x02') mapbox_vector_tile.encode(decoded_tile)

But I can't. Is there any way you can do it?

fallaciousreasoning commented 2 months ago

:+1: seems like a bit of an oversight that you can't do mvt.encode(mvt.decode(bytes))

rmarianski commented 2 months ago

the README has some pointers on encoding/decoding. However, if you're looking to make direct alterations, consider interacting with the protobufs directly.

nvkelso commented 2 months ago

Suggest adding a discussion topic over in https://github.com/maplibre/maplibre-tile-spec as next iteration of format is being worked on there...