Best way to merge mbTiles files together - openmaptiles

I have generated mbtiles for different sub regions of USA map from openMapTiles. Now, I wanted to merge all the generated mbTiles files together. What's the better way to do this?
Thanks!

Once you have tile-join ( https://github.com/mapbox/tippecanoe ) tool, it should be easy. I am just patching version so it is easy to reuse same styles right away (for klokantech/tileserver-gl)
so my mixing script now :
rm mix.mbtiles
tile-join -o mix.mbtiles *.mbtiles
sqlite3 mix.mbtiles 'UPDATE "main"."metadata" SET value="3.8" where name ="version";`

Related

Is there a way to filter for ways that are outers in Osmium?

I am trying to get an extract of an osm file that contains ways that are outers of relations. How would I go about doing this? I have tried using osmium tags-filter but cannot seem to find an option that works for finding outers, as those specifically have no tags.
This is the website from which I downloaded the input .osm.pbf file. The file is linked to in the “United States of America” row under the “.osm.pbf” column
Thank you for your help!

Why are there tag keys missing when downloading OSM data to Postgis / Postgresql?

I'm working on a routing application using OSM data in pgrouting. I'm using overpass-api to access the data from a specific bounding box. However, after downloading the data, there seem to be tag_keys missing from the data.
When inspecting the data using postgis or QGIS, certain tag_keys are there, like "highway", "oneway" or "maxpeed". However, others seem to be missing. In particular the tag keys "bicycle" (with possible values like "yes" or "no") or "access" are not included in the data. These tag keys are available on OSM online, however.
The following code is used to retrieve the data from OSM through Overpass-API and put it into PGrouting
CITY="Utrecht_west"
BBOX="4.9926,52.0698,5.0772,52.1172"
wget --progress=dot:mega -O "$CITY.osm" "http://www.overpass-api.de/api/xapi?*[bbox=${BBOX}][#meta]"
OSM2pgrouting converter
cd ~/Desktop/Utrecht
osm2pgrouting \
-f Utrecht_west.osm \
-d utrecht_west \
-U user
I expect these lines to download all data in the bounding box, but some tag keys seem to be missing. What am I doing wrong here?
edit: it seems to be a similar issue to this post, however, I cannot find another answer to a similar issue
I'm not familiar with osm2pgrouting. However it looks like mapconfig.xml doesn't include "bicycle" and "access" tags. You either need to add them or create your own config file. If you want osm2pgrouting to consider these tags during routing this might not be enough, though.

Launch OSRM server on large area

in the tutorial it is shown how to start an OSRM server with this example :
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
osrm-extract berlin-latest.osm.pbf -p profiles/car.lua
osrm-contract berlin-latest.osrm
osrm-routed berlin-latest.osrm
I would like to start a server not only on Berlin dataset, but on a full country dataset. For instance all German country roads. Maybe there is something to do with the contract, but i don't really know what king of .osrm i should put as argument to tell it to use a larger dataset that would be the combination of several dataset.
I think the answer should be really obvious when we know it, but it still feel a bit wooly.
Thank you.
According to an OSRM issue it is not possible to merge .osrm files. However you can merge multiple PBF files before generating your .osrm files.
Merging of OSM XML or PBF files can be done with osmium:
osmium merge file1.osm.pbf file2.osm.pbf -o merged.osm.pbf.
Or with osmosis:
osmosis --rb file1.osm.pbf --rb file2.osm.pbf --m --wb merged.osm.pbf
wget http://download.geofabrik.de/europe/germany-latest.osm.pbf
osrm-extract germany-latest.osm.pbf -p profiles/car.lua
osrm-contract germany-latest.osrm
osrm-routed germany-latest.osrm
Should work, but please note it will require around 16GB of RAM and probably a similar amount of disk space.
EDIT:
After clarification what you will need to do is merge the .osm.pbf files using the osmium tool.
./osmium merge first.osm.pbf second.osm.pbf third.osm.pbf -o result.osm.pbf

How can I parse *.vector.pbf about Mapbox vector tile map?

*.pbf("Protocolbuffer Binary Format") is primarily intended as an alternative to the XML format.
There are two formats of *.osm.pbf and *.vector.pbf. What tools can I use to open these files? (I know JOSM can open *.osm.pbf files, but it can't open *.vector.pbf files.)
If I want to write own *.vector.pbf files in Mapbox, how do I work for that?
Thanks!
Regarding question #2, extracting PBF data
Using GDAL's ogr2ogr is the easiest method (I found).
Given a file named 1583.vector.pbf decode it to a, for example, shapefile (folder) named output:
# cmd show prog. output format output name input name
ogr2ogr -progress -f "ESRI Shapefile" output 1583.vector.pbf
Regarding question #3, creating PBF data
Use the same command as above but swap the input/outputs and output format:
# example source: https://gdal.org/drivers/vector/mvt.html
ogr2ogr -f MVT mytileset source.gpkg -dsco MAXZOOM=10
The Vector tiles used by Mapbox are serialized as Protocol Buffers.
Protocol Buffers allow you to efficiently compress the vector data inside the tile.
The Mapbox Tile Specification is available on github.
Esri has also adopted the same specification for their products.
You can find a list of parsers, renderers & CLI utilities here: https://github.com/mapbox/awesome-vector-tiles
In the common scenario, you can use mapbox-gl-js to render the vector tiles on the client. To generate vector tiles, you can use Mapbox Studio. This will require uploading your data online in the Studio. You can also use Mapbox Studio Classic (the older version) to generate the tiles locally.
Internally, Mapbox Studio uses the tilelive API, so you can programatically generate the tiles. In the list above there are other good alternatives as well.

Use OSM Map in SUMO

I want to export a Munich map from OSM for SUMO Simulator. I've managed to download such a map from bbbike.de(472MB), but when I'm converting it to .net.xml with netconvert I'm getting a lot of warnnings and the simulator cannot import the map ("Loading error"). Do you have any idea how can I convert correctly the map (or do you think it is because the big volume of the file?), or where could I get such a map(in a properly sumo format = xml, I acctualy need just the highways, I've tried to select just highways with osmosis but I have the same problem in the end)?
Ok to summarize our experience and to close this question :)
SUMO has problems with parsing big full OSM files. So you need to cut the area and filter for highways with osmosis:
Get the state of bavaria or of the surrounding http://download.geofabrik.de/europe/germany/bayern/oberbayern.html
osmosis --read-pbf ./oberbayern-latest.osm.pbf --bounding-box top=48.3298 left=11.2699 bottom=48.0460 right=11.8948 --write-xml ./munich.xml
osmosis --read-xml ./munich.xml --tf accept-ways highway=* --used-node --write-xml ./munich_streets.xml
This can be loaded to SUMO, esp. with the eWorld GUI.