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.
Related
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.
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.
I'd like to transition the map in my app from currently Apple-Maps-SDK to Mapbox. My users already downloaded a lot of offline maps into several .mbtiles tiles containing raster data.
My question now is if it's possible to still use those while the user will be transitioning to the new maps? I just don't simply want to delete all offline maps and tell the user that he needs to download everything again right now, but rather give them a time-window to do that...
I was looking at MGLRasterTileSource/MGLSource and thought that I can create a subclass and somehow provide my own data to the map, but this does not seem to be supported. There are no datasource methods on it for that purpose...
Would be great if somebody could point me into the direction on how to archive what I want.
EDIT:
So I thought it might work that way... I migrate my existing raster tiles into a downloaded pack inside the mapbox offline database. So I had a look at the caches.db but at least the data in there is not just a plain png/jpg (tried with the mapbox satellite images, which should be raster).
Cause there is no public interface for getting existing raster-tiles in there, is there?
I've seen an other solution where somebody is hosting a webserver inside the app... but that somehow looks like quite an overkill to me?!?
https://gist.github.com/namannik/3b7c8b69c2d0768d0c2b48d2ed5ff71c
My question concerns the general purpose of the composer in qgis. My first idea was that with the composer you can "save" different layer combinations with different style to gain the possibility the have different "views" on the same data. However I realized when I change the map in QGIS, the information in the composer is also refreshed. To clarify my intent I want to give a small example:
Assume you have the gas stations of different companies for a country and you want to produce a map with all companies and maps containing only the gas stations of a certain company. So in the beginning I though I just create different composers to gain different maps but I somehow fail.
If I understand your question, you can use the composer as you wish.
When you have finished a composer, click on the map and, in the object properties, just check "lock layers for this map."
It should no longer be updated, even if you hide or display layers.
Regards.
Vincent
For large projects with a large number of composers, it's better to use layer presets and the "Follow visibility preset" option within the composer.
This is because when using "lock layers" and "lock layer styles", it saves all of the layers and their styles and properties. When it does this for each composer, it can quickly balloon the size of the QGIS file. This can make it take an extremely long time to open a project, cause a lot of performance issues, and inevitably will corrupt your QGIS file. Following a visibility preset simply references the style for the layer rather than duplicates it.
E.g. I had an employee whose QGIS file got corrupted and I had him send it and the backup files to me. On review, the primary QGIS file was empty, and the backup file was an exceptional 65mb. The markup behind the QGIS file was nearly a million lines long. It was corrupted because it got cut off, so I'm not even sure how long it might have been in it's entirety. This was a result of him having about 30 layers and over 100 composers that each had the layers locked. It also explained why he was the only one who was constantly complaining about his laptop being too slow for the work :)
in answer to your statement “My question concerns the general purpose of the composer in qgis”
For me and as In understand the purpose of the print composer in qgis is more to provide an output for GIS project in a cartographic format .and it is very Cleary detailed in the qgis documentation “The Print Composer provides growing layout and printing capabilities. It allows you to add elements such as the QGIS map canvas, text labels, images, legends, scale bars, basic shapes, arrows, attribute tables and HTML frames “(see the link bellow)
If you need more information about how to use it please visit this link
https://docs.qgis.org/2.2/en/docs/user_manual/print_composer/print_composer.html?highlight=qgis%20composer
Best Regard,
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.