Mapbox Project Layer Limit (Only 15 Layers) - mapbox

I have created a project in mapbox. I have multiple layers of point, lines and polygon features, which are uploaded through its online uploading facility of .mbtiles. Mapbox project only support 15 layers, whereas I have multiple layers more than 15 to upload, and now I want to combine multiple layers.
While searching I've found this help from mapbox "Each MBTiles file you upload to Mapbox can be up to 5GB. Larger projects can be uploaded by splitting the export up into multiple smaller MBTiles files. Once uploaded, you can combine them together with the project editor. This just refers to the transfer limit and should not be confused with your storage limit."
In Mapbox Project Editor I have not find any layer combine facility ... Please help me

The combination referenced in the help refers to adding the layers individually with the data manager. 15 is the limit so you may have to combine layers in TileMill.

Related

How to optimize GeoJSON file size before uploading to Mapbox Studio

I have a GeoJSON file that I'd like to upload to Mapbox Studio as a tileset, so that I can use this custom data as a layer in my map style. The file is larger than the 300MB Studio upload limit. I know that I could use the Uploads API to upload it instead, or use Mapbox Tiling Service to both optimize the data with a recipe, and upload it as a tileset, but I'm less familiar with the command line.
Is there another option to remove some data properties I don't need from my GeoJSON file (so that I can reduce the size below 300 MB) and then upload it to Mapbox Studio as a tileset?
Following comments from 2018 on this GIS Stack Exchange post, I was able to:
Add my GeoJSON file as a new Vector Layer in QGIS,
Select "Open Attribute Table" and click the "Delete field" icon mentioned in this documentation (see screenshot below). I then selected about half of my file's fields (which I don't need) and deleted them.
I right-clicked on my layer and exported it.
This cut my file size in half, and I was able to upload to Studio on the tilesets page in my Mapbox account!
It looks like another viable option to remove unnecessary fields using QGIS would be to go to Layer > Save As and only select certain fields I want to include (see screenshot below), and export the layer before uploading the optimized file to Studio.

Get/list source-layers from Mapbox GL JS vector source

In Mapbox GL JS I am adding a vector tile source from a locally hosted mbtiles file. Adding this source to my map instance is easy like below.
map.addSource("polylinesSource",{
"type":"vector",
"tiles": [
"http://localhost:8000/polylinesJoined/{z}/{x}/{y}.pbf"
]
})
The source-layers from this service will be dynamic and I am hoping for a way to reference all those layers once the source is loaded. Is it possible to list all the layers in a source once loaded?
This is surprisingly fiddly to do. Mapbox-GL-JS doesn't expose any methods to list the vector tile source layers available within a tileset.
I built vector inspector to solve this exact problem. The code here shows you the process for extracting that information from a .pbf: https://github.com/stevage/vector-inspector-api/blob/master/server.js
Alternatively, since you have the local mbtiles file, another option is to extract it locally. Using another tool I built, tileinfo.
Also, if you serve the tiles using something like tessera you can access the layers info directly at the TileJSON endpoint.

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.
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:
Convert your data to GeoJSON using a tool like toGeojson
Upload the GeoJSON to Mapbox Studio
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.

How to compact mbtiles with mbutil

I'm creating maptiles with arc2earth and ArcGIS and it creates a lot of duplicate tiles.
I would like to reduce its size using mbtiles. I think it is possible to "compact" tiles, but I don't find the way.
Do you know if mbtiles still have compact command or it is just been deprecated?
Thanks!
At the moment mbutil doesn't expose this as an option - TileMill is the only client that supports properly compressed tiles. Of course, mbutil is an open source project, so if you're game, you can built it and add it.

Proper way to create tile maps for Leaflet.js?

I am trying to build a custom-designed map, with correct geodata. It could even be an image created in illustrator, but it has to be exported as a set of tiles in correct map format - so that it can be read by tools like Leaflet.js
What confuses me is that none of the available map tools seem to work very well together. I did find Tilemill, which looks very promising (it has a very clean interface and works with CSS), but:
Openstreetmaps does not allow downloading tile images, only XML data in OSM format.
Tilemill does not allow importing Openstreetmaps XML data (why!).
Even if you manage to design a map in Tilemill, you still cannot export tile images, only a proprietary SQL database format? What's the point of that?
If Tilemill is useless, are there other tools that allow opening OSM XML data and applying your own design styles?
There are some sources that talk about building your own tile server:
This source suggests converting OSM to PostGIS using SQL, and then using a custom python script and a tool named Mapnik. Then it says that it's not recommended to use Mapnik for OSM....
This source sounds promising, but then it casually mentions that you have to build and run your own custom Linux distribution...
Is there a simpler way to create map tiles with correct filenames and folders for Leaflet.js?
Tilemill does not allow importing Openstreetmaps XML data (why!).
OpenStreetMap XML is an interchange format: it's a way to transfer things around, not to use them. You can import it into PostGIS and use it in TileMill.
Even if you manage to design a map in Tilemill, you still cannot export tile images, only a proprietary SQL database format? What's the point of that?
If you export millions of tile images, you'll fill up your hard disk and run out of inodes. It's a bad deal. That's why we made MBTiles, which is not proprietary, but very much open source in every definition of the word, and you can export it to disk with mb-util if you so wish.
If Tilemill is useless, are there other tools that allow opening OSM XML data and applying your own design styles?
TileMill isn't useless, but if you want another option, you can use Maperitive, though it is proprietary in every sense of the word.