Package: hm-render-landez
Rendering paper maps from tiles using Landez and MapnikThis program renders an area with given boundaries using tiles from either amapbox MBTiles file, atile serveror locally rendered usingmapnik. It is designed to work with hikingmap but it can be used standalone as well if desired.InstallationClone this repository and run the following command in the created directory.pythonsetup.pyinstallUsagehm-render-landez [OPTION]... [gpxfiles]... bbox|center ...Options:ParameterDescription--pagewidthPage width in cm--pageheightPage height in cm-b, --basenameBase filename without extension-tTemp track file to render. This is used by hikingmap to draw the page boundaries of the overview map, the tracks will be saved as a temporary GPX file.-yTemp waypoints file to render. This is used by hikingmap to render the distance each kilometer or mile, the waypoints will be saved as a temporary GPX file.-v, --verboseDisplay extra information while processing.-h, --helpDisplay help-d, --dpiAmount of detail to render in dots per inch, default 300-S, --scale-factorScale factor, default 1.0--hikingmapstyleHikingmap stylesheet file, contains the CartoCSS for the tracks and the waypoints. The default is hikingmapstyle.xml, see the repository for an example.-f, --formatOutput format. Consult the mapnik documentation for possible values, default png--mbtilesInput raster mbtiles file--mapnik-styleMapnik stylesheet file--wmts-urlRemote URL to download tiles--wmts-subdomainsURL subdomains--cachedirLocal folder containing cached tiles, will be placed in the system temp directory if not specified--tilesizeTile size, default 256--tileformatTile image format, default image/png--tileschemeTile scheme, default wmtsgpxfilesThe GPX track(s) to render.You should at least specify one tile source, read the section abouttile source precedencefor detailed information.
After these parameters you are required to make a choice between bbox and center. In bbox mode the rendered area will be a defined bounding box and in center mode you can specify a center coordinate and a scale.Options for bbox mode:ParameterDescription-o, --minlonMinimum longitude of the page-O, --maxlonMaximum longitude of the page-a, --minlatMinimum latitude of the page-A, --maxlatMaximum latitude of the pageNote that mapnik will maintain the aspect ratio, the rendered area may not correspond exactly to the given boundary.Options for center mode:ParameterDescription--lonLongitude of the center of the page--latLatitude of the center of the page--scaleScale denominator, default 50000Configuration fileBecause most of the time you will want to use the same parameters, you can optionally override the defaults in a configuration file. hm-render-landez will search for a file hm-render-landez.config.xml in the current directory, if not found it will resort to ~/.hm-render-landez.config.xml<?xml version="1.0" encoding="utf-8"?>
<hm-render-landez>
    <tilesmanager>
        <mbtiles_file>mbsource.mbtiles</mbtiles_file>
        <mapnik_stylefile>mapnik_style.xml</mapnik_stylefile>
        <wmts_url>https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png</wmts_url>
        <wmts_subdomains>abc</wmts_subdomains>
        <cache_dir>tilecache</cache_dir>
        <tile_size>256</tile_size>
        <tile_format>image/png</tile_format>
        <tile_scheme>wmts</tile_scheme>
    </tilesmanager>
    <hikingmapstyle>hikingmap_style.xml</hikingmapstyle>
    <outputformat>png</outputformat>
    <dpi>300</dpi>
    <scalefactor>1.0</scalefactor>
    <fontdirs>
        <fontdir>/usr/share/fonts/noto</fontdir>
        <fontdir>/usr/share/fonts/noto-cjk</fontdir>
        <fontdir>/usr/share/fonts/TTF</fontdir>
    </fontdirs>
</hm-render-landez>Options:TagDescriptionmbtiles_fileOptional. An MBTiles file providing raster tiles.mapnik_stylefileOptional. Mapnik stylesheet file.wmts_urlOptional. Remote URL to download tiles.wmts_subdomainsOptional. URL subdomains.cache_dirLocal folder containing cached tiles.tile_sizeTile size.tile_formatTile image format.tile_schemeTile scheme, value can be tms or wmts.hikingmapstyleHikingmap stylesheet file, contains the CartoCSS for the tracks and the waypoints, see the repository for an example.outputformatOutput format. Consult themapnik documentationfor possible values.dpiAmount of detail to render in dots per inch. This value is unrelated to the setting on your printer, a higher value will simply result in smaller icons, thinner roads and unreadable text.scalefactorThe scale factor to compensate for a higher dpi value.fontdirsOptional. Can contain one or more fontdir subtags with additional font directories to be used by mapnik.PrerequisitesTo run this script you should have a working installation ofpython 3,Landezandmapnik. Make sure you also havepython-mapnikinstalled.Tile sourcesThe tiles are cached in a local folder using the tile manager of Landez. Landez will add tiles to the cache when necessary, supporting a number of possible sources.MBTilesThis is a file format from mapbox, they can be created using tools such as (but not limited to)mapbox mbutilorMaperitive. Please note that only raster MBTiles files are supported, vector MBTiles files require rendering before use.Tile serverThis is the easiest to set up, Landez will simply download tiles from a web source. Make sure you don't violateusage policiesif you render too many maps at once or set the dpi value too high.Local rendering with mapnikSince mapnik is installed as a prerequisite of this project, it is included as a possible tile source. However the setup is rather difficult. Consult the documentation ofhm-render-mapnikto get an idea.WMS serverAlthough Landez supports WMS sources, it is not configurable here. WMS servers are generally replaced by WMTS servers, which use fewer resources on the server side.Tile source precedencePlease note you should at least specify one tile source. Although it is possible to pass all tile sources together, Landez will use only one of them. The precedence is:MBTiles, pass the parameter--mbtilesif you want to use this.Mapnik, pass the parameter--mapnik-styleif you want to use this, but don't pass--mbtiles.Tile server, pass the parameters--wmts-urland--wmts-subdomains, but don't pass--mbtilesand--mapnik-style.