mapboxgeojsongpxmapbox-studio

Multiple gpx layers in Mapbox Studio style editor


If I upload a gpx trace to convert it into a tileset, I can use it in the Style editor just as expected. But if I upload a second and want to use it as a data source for another or even the same layer, It is greyed out with the following notice:

This source includes vector layer names that are already in your composite source. vector layer names must be unique.

I didn't set any name myself or changed the gpx traces in a weird way. I even renamed the style layer. I looked into the details of the automatically created tileset but I couldn't see a name which was the same on both sources. The only thing that both gpx traces had was the "tracks" part of the source, which contained the actual trace. But I can't figure out how to change this name.

Is there some way to upload two gpx traces and use them in the same style?

I want to avoid workarounds if possible but if it doesn't work another way, I imagine that there are at least two workarounds: 1. Convert into a geojson file, upload as a dataset and convert into a tileset. 2. Somehow append multiple gpx files into one, but keep the traces separate.

What would be the downsides, apart from having more files to keep up2date? Is (2) even possible?

Update:

In the end I did convert the gpx files into geojson tracks. THis did work exactly as hoped. But I'm still interested if there's a shorter way or if I just did something wrong previously.


Solution

  • Disclaimer: I work at Mapbox.

    It isn't possible to upload multiple GPX files directly to the same map style in Mapbox because their layer names are automatically set as track. To fix this, I recommend following these steps:

    1. Convert your data to GeoJSON using a tool like toGeojson
    2. Upload the GeoJSON to Mapbox Studio
    3. Add the data to your map in Studio or GL JS

    So to answer your question: you are going about this the correct way. One thing to note: you don't have to upload it as a dataset first. You can upload your GeoJSON as a tileset directly, unless you have some editing you want to do first.