< MarbleRevision as of 11:55, 18 October 2015 by Tackat (talk | contribs) (Created page with "= 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 ...")(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff) Contents 1 OSM Vector Tiles 1.1 Creating tiles from a pbf file 1.1.1 Creating the tools - osmconvert and osmfilter 1.1.2 Running the VectorTileCreator 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 download that from: http://download.geofabrik.de/north-america/us/california.html or to be more specifically: http://download.geofabrik.de/north-america/us/california-latest.osm.pbf Creating the tools - osmconvert and osmfilter 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 and pretty much the same for osmfilter wget http://m.m.i24.cc/osmfilter.c gcc -O3 -o osmfilter osmfilter.c sudo mv osmfilter /usr/local/bin if that works, running osmconvert -h and also osmfilter -h should output usage instructions. Running the VectorTileCreator Now our tool is needed. You need python version 2 or 3 to be installed. In a shell, go to the marble sources directory and then cd tools/vectortilecreator now running ./vectortilecreator.py -h should give usage instructions. The tile cutter tool works as follows: You call it with a region file as parameter (or several). It will generate tiles in the currenty directory unless you use the -d option: For example -d ~/.local/share/marble/maps/earth/vectorosm is what you want for local tiles. By default it will generate tiles for zoom levels 13, 15, 17. You can overwrite that using the -z switch -z 13 15. for example to exclude level 17 (which takes looong for large regions) once called, the script does the following It parses the region file to read which file to work on and which boundaries it has To speed things up, it then creates another file with only the given boundaries inside (e.g. if you pass california-latest.osm.pbf and work on san francisco it will create a temporary file that has only san francisco inside) Afterwards it iterates over the zoom levels passed. For each level it calculates the tiles that are inside the boundaries. Then it calls osmconvert for each tile to generate the tile If it also finds a file levels/$ZOOM.level it will call osmfilter afterwards And finally the result is zipped Retrieved from "https://techbase.kde.org/index.php?title=Marble/OSMVectorTileCreation&oldid=85921" Content is available under Creative Commons License SA 4.0 unless otherwise noted.