IntroductionThis document describes how to use the hikingmap application. The script takes one or more GPS tracks as input and will try to calculate the minimum amount of pages needed to print the complete track, choosing between portrait and landscape on the fly. The actual rendering of the maps will be done by an external script.
DisclaimerThe scripts in this document are written and verified to work in a Linux environment. There is no reason it shouldn't work on Windows, Mac OS or other operating systems, but it might require additional steps or a slightly different approach. If you have any questions or feedback, you are welcome to contact me on roel.derickx --at-- gmail.
Table of contents
DownloadYou can find the hikingmap package on github, to run the scripts you need a working installation of Python.
RenderingHikingmap will only calculate the page boundaries, the actual rendering will be done by an external render script. You can either choose one from the list below or write your own.
- render-mapnik: this is the default renderer used by hikingmap. All map data will be stored offline and elevation lines are supported, however the setup is rather difficult.
- render-tiles: this is an alternative renderer which was initially written to be used with MBTiles files, but it can be configured to use a web based tile server as well. Please consult the documentation on the project page before use.
Writing your own rendererAll you have to do to write your own renderer is to create a directory with a render.py script inside. Hikingmap passes certain parameters, you are free to use or ignore them as you wish. A good start is the dummy renderer included in the hikingmap package, it contains already a class for parsing all parameters.
|-o||Minimum longitude of the area boundaries|
|-O||Maximum longitude of the area boundaries|
|-a||Minimum latitude of the area boundaries|
|-A||Maximum latitude of the area boundaries|
|-w||Page width in cm|
|-h||Page height in cm|
|-t||Temp track file to render. This is used to draw the page boundaries of the overview map, hikingmap will save those as a temporary GPX file.|
|-y||Temp waypoints file to render. This is used to render the distance each kilometer or mile, hikingmap will save those waypoints as a temporary GPX file.|
|-v, --verbose||Display extra information while processing.|
|-h, --help||Display help|
|gpxfiles||The GPX track(s) to render.|
hikingmap.py [OPTION]... gpxfiles...Options:
|-s||--scale||The scale denominator|
|--pagewidth||The width of the resulting map in portrait orientation. The application will automatically use pageheight when rendering in landscape orientation. The value should be the width of the desired papersize minus the horizontal margins on both sides.|
|--pageheight||The height of the resulting map in portrait orientation. The application will automatically use pagewidth when rendering in landscape orientation. The value should be the height of the desired papersize minus the vertical margins on both sides.|
|--pageoverlap||The amount of overlap between two consecutive pages, in cm.|
|--overview||Generate overview map.|
|-w||--waypoints||If this parameter is given the cumulative distance from the origin will be rendered each N kilometers or miles.|
|-u||--unit||Length unit in which the value of the waypoints parameter is expressed. Possible values are km or mi.|
|-o||--page-order||Order in which pages are generated. Possible values are naturalorder, rectoverso or book.|
|-b||--basename||Output filename base. All output file names will start with this parameter, followed by a sequence number and a file extension depending on the specified format.|
|-r||--renderdir||Directory containing the renderscript.|
|-v||--verbose||Display extra information while processing.|
|gpxfiles||The GPX track(s) to follow. More than one GPX file can be given, the script will render all tracks given.|
- All tracks will be scanned and consecutive tracks will automatically be combined into a single track
- The tracks will be rendered in the given order. The script tries to center the track as much as possible and decides whether to use portrait or landscape to optimize paper usage
- If a track is finished and remaining tracks are to be rendered, only the parts which are not yet rendered will be processed. This might be only a part of the track, and only this part will be centered
ResultsBelow you can find part of a rendered track. The maps were rendered on a 1:50000 scale for A4 paper size. The resulting PDF files were converted to PNG and subsequently scaled down to save bandwith, they are included here only as an example to show how the track is rendered and how pages fit together. Click on the image for a larger view.
- Currently the track is centered on a page, either horizontally in case of portrait or vertically in case of landscape orientation. However, side tracks can fall outside the boundaries of the page because of this. The centering should be made more intelligent to maximize the amount of tracks on the page
This page is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
This page was last updated on october 11, 2019