# Decoding protobuf message from mapbox API, using ProtoBuf.jl

**URL:** <https://discourse.julialang.org/t/decoding-protobuf-message-from-mapbox-api-using-protobuf-jl/82261>\
**Category:** General Usage\
**Tags:** question\
**Created:** [June 5, 2022, 6:13am UTC](https://discourse.julialang.org/t/decoding-protobuf-message-from-mapbox-api-using-protobuf-jl/82261 "2022-06-05T06:13:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![captchanjack1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/captchanjack1/32/28877_2.png) [@captchanjack1](https://discourse.julialang.org/u/captchanjack1)\
**Post date:** [June 5, 2022, 6:13am UTC](https://discourse.julialang.org/t/decoding-protobuf-message-from-mapbox-api-using-protobuf-jl/82261/1 "2022-06-05T06:13:30Z")

</div>

Hi,

I’m new to the world of protocol buffers, looking for some guidance here.

I have a fairly simple use case which is to decode protobuf messages from the mapbox API into GeoJSON format.

How would I approach this problem? Would I need to define a custom Julia struct according to this [mapbox pbf specification](https://github.com/mapbox/vector-tile-spec/tree/master/2.1)? Or is there a simpler, more generic way of decoding the protobuf message into a Dict of some sort.

Essentially I would like to replicate what this [python library](https://github.com/tilezen/mapbox-vector-tile) is doing!

Thanks in advance…

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [June 5, 2022, 8:34am UTC](https://discourse.julialang.org/t/decoding-protobuf-message-from-mapbox-api-using-protobuf-jl/82261/2 "2022-06-05T08:34:35Z")

</div>

The general idea for handling protobuf formats are:

1. Generate code from `*.proto` files using the `protoc` compiler with a suitable plugin for your language of choice.
2. Call the generated code to decode or encode protobuf messages.
3. (Optional) Convert to and from more user friendly data structures than are involved in step 2.

The Julia [ProtoBuf](https://github.com/JuliaIO/ProtoBuf.jl) package helps you with the first two steps. Follow the links from the README for documentation of respective step.
