Marble/OSMVectorTileCreation: Difference between revisions
Earthwings (talk | contribs) |
Earthwings (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
As an example we'd like to render tiles for tile level 13, 15 and 17 of San Francisco. | As an example we'd like to render tiles for tile level 13, 15 and 17 of San Francisco. | ||
First you need the osm.pbf file for that region. In our case we | First you need the osm.pbf file for that region. In our case we get it from: | ||
http://download.geofabrik.de/north-america/us/california.html | http://download.geofabrik.de/north-america/us/california.html | ||
where we locate the link to the pbf file as http://download.geofabrik.de/north-america/us/california-latest.osm.pbf | |||
=== Creating the tools - osmconvert and | === Creating the tools - osmconvert and marble-vectorosm-tilecreator === | ||
Now we need the tools for conversion and filtering the pbf file into tiles. In order to compile the tools you should have zlib installed on your system (e.g. via sudo apt-get install zlib1g-dev). Then run: | Now we need the tools for conversion and filtering the pbf file into tiles. In order to compile the tools you should have zlib installed on your system (e.g. via sudo apt-get install zlib1g-dev). Then run: | ||
Line 19: | Line 19: | ||
gcc -O3 -o osmconvert osmconvert.c -lz | gcc -O3 -o osmconvert osmconvert.c -lz | ||
sudo mv osmconvert /usr/local/bin | sudo mv osmconvert /usr/local/bin | ||
</source> | </source> | ||
Line 29: | Line 25: | ||
<source lang="bash"> | <source lang="bash"> | ||
osmconvert -h | osmconvert -h | ||
</source> | </source> | ||
should output usage instructions. | should output usage instructions. | ||
Please compile Marble from source code as well as described in https://marble.kde.org/sources.php and make sure to compile the development version (master branch). Pass the option -DBUILD_MARBLE_TOOLS=TRUE to cmake in order to compile all Marble tools. | |||
=== Running the VectorTileCreator === | === Running the VectorTileCreator === | ||
Now our tool is needed | Now our tool is needed. In a shell, go to the marble build directory and then | ||
<source lang="bash"> | <source lang="bash"> | ||
cd tools/ | cd tools/vectorosm-tilecreator | ||
</source> | </source> | ||
now running | now running | ||
<source lang="bash"> | <source lang="bash"> | ||
./ | ./marble-vectorosm-tilecreator -h | ||
</source> | </source> | ||
should give usage instructions. | should give usage instructions. | ||
The tile cutter tool works as follows: You call it with a | The tile cutter tool works as follows: You call it with a link to an osm .pbf file as parameter. | ||
The tool will generate tiles for zoom levels 11, 13, 15 and 17 by default. You can overwrite that using the -z switch, e.g. | |||
-z 13 15. | |||
=== Full Example === | |||
If you follow the steps above, the final tile creation run after installing the required tools will look like this: | |||
<source lang="bash"> | |||
- | cd ~/marble/build/ | ||
cd tools/vectorosm-tilecreator | |||
./marble-vectorosm-tilecreator http://download.geofabrik.de/north-america/us/california-latest.osm.pbf | |||
[========================================>] 100% 0.0/0.0 MB Downloading california-latest.osm.pbf | |||
[========================================>] 100% 0.0/0.0 MB Downloading california.poly | |||
[========================================>] 100% osm cache tiles complete. | |||
[========================================>] 100% landmass cache tiles complete. | |||
[========================================>] 100% Vector OSM tiles complete. | |||
=== | </source> | ||
Revision as of 13:25, 19 November 2016
OSM Vector Tiles
Creating tiles from a pbf file
As an example we'd like to render tiles for tile level 13, 15 and 17 of San Francisco. First you need the osm.pbf file for that region. In our case we get it from:
http://download.geofabrik.de/north-america/us/california.html
where we locate the link to the pbf file as http://download.geofabrik.de/north-america/us/california-latest.osm.pbf
Creating the tools - osmconvert and marble-vectorosm-tilecreator
Now we need the tools for conversion and filtering the pbf file into tiles. In order to compile the tools you should have zlib installed on your system (e.g. via sudo apt-get install zlib1g-dev). Then run:
cd /tmp
wget http://m.m.i24.cc/osmconvert.c
gcc -O3 -o osmconvert osmconvert.c -lz
sudo mv osmconvert /usr/local/bin
if that works, running
osmconvert -h
should output usage instructions.
Please compile Marble from source code as well as described in https://marble.kde.org/sources.php and make sure to compile the development version (master branch). Pass the option -DBUILD_MARBLE_TOOLS=TRUE to cmake in order to compile all Marble tools.
Running the VectorTileCreator
Now our tool is needed. In a shell, go to the marble build directory and then
cd tools/vectorosm-tilecreator
now running
./marble-vectorosm-tilecreator -h
should give usage instructions.
The tile cutter tool works as follows: You call it with a link to an osm .pbf file as parameter.
The tool will generate tiles for zoom levels 11, 13, 15 and 17 by default. You can overwrite that using the -z switch, e.g. -z 13 15.
Full Example
If you follow the steps above, the final tile creation run after installing the required tools will look like this:
cd ~/marble/build/
cd tools/vectorosm-tilecreator
./marble-vectorosm-tilecreator http://download.geofabrik.de/north-america/us/california-latest.osm.pbf
[========================================>] 100% 0.0/0.0 MB Downloading california-latest.osm.pbf
[========================================>] 100% 0.0/0.0 MB Downloading california.poly
[========================================>] 100% osm cache tiles complete.
[========================================>] 100% landmass cache tiles complete.
[========================================>] 100% Vector OSM tiles complete.