Update readme.

This commit is contained in:
Sergey Vartanov 2021-08-24 01:50:18 +03:00
parent 767b4e1127
commit cbfdb4de78
4 changed files with 157 additions and 129 deletions

146
README.md
View file

@ -1,3 +1,5 @@
**Röntgen** (or **Roentgen** when ASCII is preferred) project consists of **Röntgen** (or **Roentgen** when ASCII is preferred) project consists of
* simple Python [OpenStreetMap](http://openstreetmap.org) renderer (see [usage](#usage), [renderer documentation](#map-generation)), * simple Python [OpenStreetMap](http://openstreetmap.org) renderer (see [usage](#usage), [renderer documentation](#map-generation)),
@ -9,16 +11,20 @@ Unlike standard OpenStreetMap layers, **Röntgen is a playground for experiments
Röntgen is intended to be highly configurable, so it can generate precise but messy maps for OSM contributors as well as pretty and clean maps for OSM users, can use slow algorithms for some experimental features. Röntgen is intended to be highly configurable, so it can generate precise but messy maps for OSM contributors as well as pretty and clean maps for OSM users, can use slow algorithms for some experimental features.
Usage Usage example
----- -------------
To get SVG map, just run
```bash ```bash
python roentgen.py render -b <lon1>,<lat1>,<lon2>,<lat2> roentgen render -b 2.284,48.860,2.290,48.865
``` ```
(e.g. `python roentgen.py render -b 2.284,48.86,2.29,48.865`). It will automatically download OSM data and write output map to `out/map.svg`. For more options see [Map generation](#map-generation). will automatically download OSM data and write output SVG map of the specified area to `out/map.svg`. See [Map generation](#map-generation).
```bash
roentgen tile -b 2.361,48.871,2.368,48.875
```
will automatically download OSM data and write output PNG tiles that cover the specified area to `out/tiles` directory. See [Tile generation](#tile-generation).
Map features Map features
------------ ------------
@ -32,9 +38,9 @@ Röntgen features:
* display [directions](#direction) with gradient sectors, * display [directions](#direction) with gradient sectors,
* use width to display roads. * use width to display roads.
### Simple building shapes ### ### Isometric building shapes ###
Simple shapes for walls and shade in proportion to [`building:levels`](https://wiki.openstreetmap.org/wiki/Key:building:levels), [`building:min_level`](https://wiki.openstreetmap.org/wiki/Key:building:min_level), [`height`](https://wiki.openstreetmap.org/wiki/Key:height) and [`min_height`](https://wiki.openstreetmap.org/wiki/Key:min_height) values. Isometric shapes for walls and shade in proportion to [`building:levels`](https://wiki.openstreetmap.org/wiki/Key:building:levels), [`building:min_level`](https://wiki.openstreetmap.org/wiki/Key:building:min_level), [`height`](https://wiki.openstreetmap.org/wiki/Key:height) and [`min_height`](https://wiki.openstreetmap.org/wiki/Key:min_height) values.
![3D buildings](doc/buildings.png) ![3D buildings](doc/buildings.png)
@ -71,7 +77,11 @@ There are [special symbols](https://en.wikipedia.org/wiki/List_of_Japanese_map_s
Icon set Icon set
-------- --------
If tag is drawable it is displayed using icon combination and colors. All icons are under [CC BY](http://creativecommons.org/licenses/by/4.0/) license. So, do whatever you want but give appropriate credit. Icon set is heavily inspired by [Maki](https://github.com/mapbox/maki), [Osmic](https://github.com/gmgeo/osmic), and [Temaki](https://github.com/ideditor/temaki) icon sets. The central feature of the project is Röntgen icon set. It is a set of monochrome 14 × 14 px pixel-aligned icons. Unlike the Röntgen source code, which is under MIT license, all icons are under [CC BY](http://creativecommons.org/licenses/by/4.0/) license. So, with the appropriate credit icon set can be used outside the project. Some icons can be used as emoji symbols.
All icons tend to support common design style, which is heavily inspired by [Maki](https://github.com/mapbox/maki), [Osmic](https://github.com/gmgeo/osmic), and [Temaki](https://github.com/ideditor/temaki).
Icons are used to visualize tags for nodes and areas. Unlike other renderers, Röntgen can use more than one icon to visualize an entity and use colors to visualize [`colour`](https://wiki.openstreetmap.org/wiki/Key:colour) value or other entity properties (like material or genus).
![Icons](doc/grid.png) ![Icons](doc/grid.png)
@ -79,26 +89,14 @@ Feel free to request new icons via issues for whatever you want to see on the ma
Generate icon grid and sets of individual icons with `python roentgen.py icons`. It will create `out/icon_grid.svg` file, and SVG files in `out/icons_by_id` directory where files are named using shape identifiers (e.g. `power_tower_portal_2_level.svg`) and in `icons_by_name` directory where files are named using shape names (e.g. `Röntgen portal two-level transmission tower.svg`). Files from the last directory are used in OpenStreetMap wiki (e.g. [`File:Röntgen_portal_two-level_transmission_tower.svg`](https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg)). Generate icon grid and sets of individual icons with `python roentgen.py icons`. It will create `out/icon_grid.svg` file, and SVG files in `out/icons_by_id` directory where files are named using shape identifiers (e.g. `power_tower_portal_2_level.svg`) and in `icons_by_name` directory where files are named using shape names (e.g. `Röntgen portal two-level transmission tower.svg`). Files from the last directory are used in OpenStreetMap wiki (e.g. [`File:Röntgen_portal_two-level_transmission_tower.svg`](https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg)).
### Icon combination ### ### Shape combination ###
Some icons can be combined into new icons. Röntgen constructs icons from the shapes extracted from the sketch SVG file. Some icons consists of just one shape, to construct other it may be necessary to combine two or more shapes.
![Bus stop icon combination](doc/bus_stop.png) ![Bus stop icon combination](doc/bus_stop.png)
Map styles Wireframe view
---------- --------------
### All tags style ###
Options: `--show-missing-tags --overlap 0`.
Display as many OpenStreetMap data tags on the map as possible.
### Pretty style ###
Options: `--draw-captions main --level overground`.
Display only not overlapping icons and main captions.
### Creation time mode ### ### Creation time mode ###
@ -115,7 +113,7 @@ Every way and node displayed with the random color picked for each author with `
Installation Installation
------------ ------------
Requirements: Python (at least 3.9). Requirements: Python 3.9.
To install all packages, run: To install all packages, run:
@ -126,65 +124,68 @@ pip install -r requirements.txt
Map generation Map generation
-------------- --------------
Command: `render`. Command `render` is used to generates SVG map from OpenStreetMap data. You can run it using:
There are simple Python renderer that generates SVG map from OpenStreetMap data. You can run it using:
```bash ```bash
python roentgen.py render \ roentgen render \
-b ${LONGITUDE_1},${LATITUDE_1},${LONGITUDE_2},${LATITUDE_2} \ -b <min longitude>,<min latitude>,<max longitude>,<max latitude> \
-o ${OUTPUT_FILE_NAME} \ -o <output file name> \
-s ${OSM_ZOOM_LEVEL} -s <osm zoom level> \
<other arguments>
``` ```
Example: ### Example ###
```bash ```bash
python roentgen.py render -b 2.284,48.86,2.29,48.865 roentgen render \
--boundary-box 2.284,48.860,2.290,48.865 \
--output out/esplanade_du_trocadéro.svg
``` ```
will download OSM data to `cache/2.284,48.860,2.290,48.865.osm` and write output SVG map of the specified area to `out/esplanade_du_trocadéro.svg`.
### Arguments ### ### Arguments ###
| Option | Description | | Option | Description |
|---|---| |---|---|
| `-i`, `--input` | input XML file name or names (if not specified, file will be downloaded using OpenStreetMap API) | | <span style="white-space: nowrap;">`-i`</span>, <span style="white-space: nowrap;">`--input`</span> `<path>` | input XML file name or names (if not specified, file will be downloaded using OpenStreetMap API) |
| `-o`, `--output` | output SVG file name, default value: `out/map.svg` | | <span style="white-space: nowrap;">`-o`</span>, <span style="white-space: nowrap;">`--output`</span> `<path>` | output SVG file name, default value: `out/map.svg` |
| `-b`, `--boundary-box` | geo boundary box, use space before "-" if the first value is negative | | <span style="white-space: nowrap;">`-b`</span>, <span style="white-space: nowrap;">`--boundary-box`</span> `<lon1>,<lat1>,<lon2>,<lat2>` | geo boundary box; if first value is negative, enclose the value with quotes and use space before `-` |
| `-s`, `--scale` | OSM zoom level (may not be integer), default value: 18 | | <span style="white-space: nowrap;">`-s`</span>, <span style="white-space: nowrap;">`--scale`</span> `<float>` | OSM zoom level (may not be integer), default value: 18 |
| `--cache` | path for temporary OSM files, default value: `cache` | | <span style="white-space: nowrap;">`--cache`</span> `<path>` | path for temporary OSM files, default value: `cache` |
| `--labels` | label drawing mode: `no`, `main`, or `all`, default value: `main` | | <span style="white-space: nowrap;">`--labels`</span> | label drawing mode: `no`, `main`, or `all`, default value: `main` |
| `--overlap` | how many pixels should be left around icons and text, default value: 12 | | <span style="white-space: nowrap;">`--overlap`</span> | how many pixels should be left around icons and text, default value: 12 |
| `--mode` | map drawing mode, default value: `normal` | | <span style="white-space: nowrap;">`--mode`</span> | map drawing mode, default value: `normal` |
| `--seed` | seed for random | | <span style="white-space: nowrap;">`--seed`</span> | seed for random |
| `--level` | display only this floor level | | <span style="white-space: nowrap;">`--level`</span> | display only this floor level |
Tile generation Tile generation
--------------- ---------------
Command: `tile`. Command `tile` is used to generate PNG tiles for [slippy maps](https://wiki.openstreetmap.org/wiki/Slippy_Map). To use them, run [Röntgen tile server](#tile-server).
| Option | Description | | Option | Description |
|---|---| |---|---|
| `-c`, `--coordinates` | coordinates of any location inside the tile | | <span style="white-space: nowrap;">`-c`</span>, <span style="white-space: nowrap;">`--coordinates`</span> `<latitude>,<longitude>` | coordinates of any location inside the tile |
| `-s`, `--scale` | OSM zoom level, default value: 18 | | <span style="white-space: nowrap;">`-s`</span>, <span style="white-space: nowrap;">`--scale`</span> `<integer>` | OSM zoom level, default value: 18 |
| `-t`, `--tile` | tile specification | | <span style="white-space: nowrap;">`-t`</span>, <span style="white-space: nowrap;">`--tile`</span> `<scale>/<x>/<y>` | tile specification |
| `--cache` | path for temporary OSM files, default value: `cache` | | <span style="white-space: nowrap;">`--cache`</span> `<path>` | path for temporary OSM files, default value: `cache` |
| `-b`, `--boundary-box` | construct the minimum amount of tiles that cover requested boundary box | | <span style="white-space: nowrap;">`-b`</span>, <span style="white-space: nowrap;">`--boundary-box`</span> `<lon1>,<lat1>,<lon2>,<lat2>` | construct the minimum amount of tiles that cover requested boundary box |
### Generate one tile ### ### Generate one tile ###
Specify tile coordinates: Specify tile coordinates:
```bash ```bash
python roentgen.py tile --tile ${OSM_ZOOM_LEVEL}/${X}/${Y} roentgen tile --tile <OSM zoom level>/<x>/<y>
``` ```
or specify any geographical coordinates inside a tile: or specify any geographical coordinates inside a tile:
```bash ```bash
python roentgen.py tile \ roentgen tile \
--coordinates ${LATITUDE},${LONGITUDE} \ --coordinates <latitude>,<longitude> \
--scale ${OSM_ZOOM_LEVEL} --scale <OSM zoom level>
``` ```
Tile will be stored as SVG file `out/tiles/tile_<zoom level>_<x>_<y>.svg` and PNG file `out/tiles/tile_<zoom level>_<x>_<y>.svg`, where `x` and `y` are tile coordinates. `--scale` option will be ignored if it is used with `--tile` option. Tile will be stored as SVG file `out/tiles/tile_<zoom level>_<x>_<y>.svg` and PNG file `out/tiles/tile_<zoom level>_<x>_<y>.svg`, where `x` and `y` are tile coordinates. `--scale` option will be ignored if it is used with `--tile` option.
@ -192,7 +193,7 @@ Tile will be stored as SVG file `out/tiles/tile_<zoom level>_<x>_<y>.svg` and PN
Example: Example:
```bash ```bash
python roentgen.py tile -c 55.7510637,37.6270761 -s 18 roentgen tile -c 55.7510637,37.6270761 -s 18
``` ```
will generate SVG file `out/tiles/tile_18_158471_81953.svg` and PNG file `out/tiles/tile_18_158471_81953.png`. will generate SVG file `out/tiles/tile_18_158471_81953.svg` and PNG file `out/tiles/tile_18_158471_81953.png`.
@ -202,9 +203,9 @@ will generate SVG file `out/tiles/tile_18_158471_81953.svg` and PNG file `out/ti
Specify boundary box to get the minimal set of tiles that covers the area: Specify boundary box to get the minimal set of tiles that covers the area:
```bash ```bash
python roentgen.py tile \ roentgen tile \
--boundary-box ${LONGITUDE_1},${LATITUDE_1},${LONGITUDE_2},${LATITUDE_2} \ --boundary-box <min longitude>,<min latitude>,<max longitude>,<max latitude> \
--scale ${OSM_ZOOM_LEVEL} --scale <OSM zoom level>
``` ```
Boundary box will be extended to the boundaries of the minimal tile set that covers the area, then it will be extended a bit more to avoid some artifacts on the edges rounded to 3 digits after the decimal point. Map with new boundary box coordinates will be written to the cache directory as SVG and PNG files. All tiles will be stored as SVG files `out/tiles/tile_<zoom level>_<x>_<y>.svg` and PNG files `out/tiles/tile_<zoom level>_<x>_<y>.svg`, where `x` and `y` are tile coordinates. Boundary box will be extended to the boundaries of the minimal tile set that covers the area, then it will be extended a bit more to avoid some artifacts on the edges rounded to 3 digits after the decimal point. Map with new boundary box coordinates will be written to the cache directory as SVG and PNG files. All tiles will be stored as SVG files `out/tiles/tile_<zoom level>_<x>_<y>.svg` and PNG files `out/tiles/tile_<zoom level>_<x>_<y>.svg`, where `x` and `y` are tile coordinates.
@ -212,33 +213,42 @@ Boundary box will be extended to the boundaries of the minimal tile set that cov
Example: Example:
```bash ```bash
roentgen.py tile -b 2.361,48.871,2.368,48.875 roentgen tile -b 2.361,48.871,2.368,48.875
``` ```
will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files `cache/2.360,48.869,2.370,48.877.svg` and `cache/2.360,48.869,2.370,48.877.png`. will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files `cache/2.360,48.869,2.370,48.877.svg` and `cache/2.360,48.869,2.370,48.877.png`.
Tile server
-----------
Command `server` is used to run tile server for slippy maps.
```
roentgen server
```
Stop server interrupting process with <kbd>Ctrl</kbd> + <kbd>C</kbd>.
MapCSS 0.2 generation MapCSS 0.2 generation
--------------------- ---------------------
Command: `mapcss`. Command `mapcss` is used to generate MapCSS scheme. `roentgen mapcss` will create `out/roentgen_mapcss` directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas: `.mapcss` file and directory with icons.
`python roentgen.py mapcss` will create `out/roentgen_mapcss` directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas: `.mapcss` file and directory with icons. To create MapCSS with only Röntgen icons run `roentgen mapcss --no-ways`.
To create MapCSS with only Röntgen icons run `python roentgen.py mapcss --no-ways`.
| Option | Description | | Option | Description |
|---|---| |---|---|
| `--icons` | add icons for nodes and areas, set by default | | <span style="white-space: nowrap;">`--icons`</span> | add icons for nodes and areas, set by default |
| `--ways` | add style for ways and relations, set by default | | <span style="white-space: nowrap;">`--ways`</span> | add style for ways and relations, set by default |
| `--lifecycle` | add icons for lifecycle tags; be careful: this will increase the number of node and area selectors by 9 times, set by default | | <span style="white-space: nowrap;">`--lifecycle`</span> | add icons for lifecycle tags; be careful: this will increase the number of node and area selectors by 9 times, set by default |
### Use Röntgen as JOSM map paint style ### ### Use Röntgen as JOSM map paint style ###
* Run `roentgen mapcss`.
* Open [JOSM](https://josm.openstreetmap.de/). * Open [JOSM](https://josm.openstreetmap.de/).
* Go to <kbd>Preferences</kbd> → Third tab on the left → <kbd>Map Paint Styles</kbd>. * Go to <kbd>Preferences</kbd> → Third tab on the left → <kbd>Map Paint Styles</kbd>.
* Active styles: press <kbd>+</kbd>. * Active styles: press <kbd>+</kbd>.
* URL / File: set path to `out/roentgen_mapcss/roentgen.mapcss`. * URL / File: set path to `out/roentgen_mapcss/roentgen.mapcss`.
* <kbd>Ok</kbd><kbd>OK</kbd>.
To enable / disable Röntgen map paint style go to <kbd>View</kbd><kbd>Map Paint Styles</kbd><kbd>Röntgen</kbd>. To enable / disable Röntgen map paint style go to <kbd>View</kbd><kbd>Map Paint Styles</kbd><kbd>Röntgen</kbd>.

View file

@ -1,3 +1,6 @@
\title {Röntgen}
\page_icon {out/icons_by_id/book.svg}
\b {Röntgen} (or \b {Roentgen} when ASCII is preferred) project consists of \b {Röntgen} (or \b {Roentgen} when ASCII is preferred) project consists of
\list \list
@ -10,13 +13,15 @@ Unlike standard OpenStreetMap layers, \b {Röntgen is a playground for experimen
Röntgen is intended to be highly configurable, so it can generate precise but messy maps for OSM contributors as well as pretty and clean maps for OSM users, can use slow algorithms for some experimental features. Röntgen is intended to be highly configurable, so it can generate precise but messy maps for OSM contributors as well as pretty and clean maps for OSM users, can use slow algorithms for some experimental features.
\2 {Usage} {usage} \2 {Usage example} {usage-example}
To get SVG map, just run \code {roentgen render -b 2.284,48.860,2.290,48.865} {bash}
\code {python roentgen.py render -b <lon1>,<lat1>,<lon2>,<lat2>} {bash} will automatically download OSM data and write output SVG map of the specified area to \m {out/map.svg}. See \ref {#map-generation} {Map generation}.
(e.g. \m {python roentgen.py render -b 2.284,48.86,2.29,48.865}). It will automatically download OSM data and write output map to \m {out/map.svg}. For more options see \ref {#map-generation} {Map generation}. \code {roentgen tile -b 2.361,48.871,2.368,48.875} {bash}
will automatically download OSM data and write output PNG tiles that cover the specified area to \m {out/tiles} directory. See \ref {#tile-generation} {Tile generation}.
\2 {Map features} {features} \2 {Map features} {features}
@ -29,9 +34,9 @@ Röntgen features\:
{display \ref {#direction} {directions} with gradient sectors,} {display \ref {#direction} {directions} with gradient sectors,}
{use width to display roads.} {use width to display roads.}
\3 {Simple building shapes} {levels} \3 {Isometric building shapes} {levels}
Simple shapes for walls and shade in proportion to \osm {building:levels}, \osm {building:min_level}, \osm {height} and \osm {min_height} values. Isometric shapes for walls and shade in proportion to \osm {building:levels}, \osm {building:min_level}, \osm {height} and \osm {min_height} values.
\image {doc/buildings.png} {3D buildings} \image {doc/buildings.png} {3D buildings}
@ -41,6 +46,8 @@ Visualization of tree leaf types (broadleaved or needleleaved) and genus or taxo
/* /*
Visualization of tree \icon {tree} leaf types (broadleaved \icon {tree_with_leaf} or needleleaved \icon {needleleaved_tree}) and genus or taxon by means of icon shapes and leaf cycles (unknown \color {#98AC64}, deciduous \color {#fcaf3e} or evergreen \color {#688C44}) by means of color. If diameter, circumference, and/or diameter_crown are specified, we draw crown and trunk as circles. We also have special icons for some genus and taxons\: birch (\i {Betula}) \icon {betula}, palm (\i {Arecaceae}) \icon {palm}, maple (\i {Acer}) \icon {tree}\icon {leaf_maple}.
\table \table
{{\osm {natural=tree}} {\icon {tree}}} {{\osm {natural=tree}} {\icon {tree}}}
{{\osm {leaf_type=broadleaved}} {\icon {tree_with_leaf}}} {{\osm {leaf_type=broadleaved}} {\icon {tree_with_leaf}}}
@ -82,7 +89,11 @@ There are \ref {https://en.wikipedia.org/wiki/List_of_Japanese_map_symbols} {spe
\2 {Icon set} {icon-set} \2 {Icon set} {icon-set}
If tag is drawable it is displayed using icon combination and colors. All icons are under \ref {http://creativecommons.org/licenses/by/4.0/} {CC BY} license. So, do whatever you want but give appropriate credit. Icon set is heavily inspired by \ref {https://github.com/mapbox/maki} {Maki}, \ref {https://github.com/gmgeo/osmic} {Osmic}, and \ref {https://github.com/ideditor/temaki} {Temaki} icon sets. The central feature of the project is Röntgen icon set. It is a set of monochrome 14 × 14 px pixel-aligned icons. Unlike the Röntgen source code, which is under MIT license, all icons are under \ref {http://creativecommons.org/licenses/by/4.0/} {CC BY} license. So, with the appropriate credit icon set can be used outside the project. Some icons can be used as emoji symbols.
All icons tend to support common design style, which is heavily inspired by \ref {https://github.com/mapbox/maki} {Maki}, \ref {https://github.com/gmgeo/osmic} {Osmic}, and \ref {https://github.com/ideditor/temaki} {Temaki}.
Icons are used to visualize tags for nodes and areas. Unlike other renderers, Röntgen can use more than one icon to visualize an entity and use colors to visualize \osm {colour} value or other entity properties (like material or genus).
\image {doc/grid.png} {Icons} \image {doc/grid.png} {Icons}
@ -90,9 +101,9 @@ Feel free to request new icons via issues for whatever you want to see on the ma
Generate icon grid and sets of individual icons with \m {\command {Test icon generation}}. It will create \m {out/icon_grid.svg} file, and SVG files in \m {out/icons_by_id} directory where files are named using shape identifiers (e.g. \m {power_tower_portal_2_level.svg}) and in \m {icons_by_name} directory where files are named using shape names (e.g. \m {Röntgen portal two-level transmission tower.svg}). Files from the last directory are used in OpenStreetMap wiki (e.g. \ref {https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg} {\m {File:Röntgen_portal_two-level_transmission_tower.svg}}). Generate icon grid and sets of individual icons with \m {\command {Test icon generation}}. It will create \m {out/icon_grid.svg} file, and SVG files in \m {out/icons_by_id} directory where files are named using shape identifiers (e.g. \m {power_tower_portal_2_level.svg}) and in \m {icons_by_name} directory where files are named using shape names (e.g. \m {Röntgen portal two-level transmission tower.svg}). Files from the last directory are used in OpenStreetMap wiki (e.g. \ref {https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg} {\m {File:Röntgen_portal_two-level_transmission_tower.svg}}).
\3 {Icon combination} {icon_combination} \3 {Shape combination} {shape_combination}
Some icons can be combined into new icons. Röntgen constructs icons from the shapes extracted from the sketch SVG file. Some icons consists of just one shape, to construct other it may be necessary to combine two or more shapes.
\image {doc/bus_stop.png} {Bus stop icon combination} \image {doc/bus_stop.png} {Bus stop icon combination}
@ -134,19 +145,7 @@ Countries with right-to-left script direction\:
*/ */
\2 {Map styles} {map-styles} \2 {Wireframe view} {wireframe-view}
\3 {All tags style} {all_tags_style}
Options\: \m {--show-missing-tags --overlap 0}.
Display as many OpenStreetMap data tags on the map as possible.
\3 {Pretty style} {pretty_style}
Options\: \m {--draw-captions main --level overground}.
Display only not overlapping icons and main captions.
\3 {Creation time mode} {time_mode} \3 {Creation time mode} {time_mode}
@ -162,7 +161,7 @@ Every way and node displayed with the random color picked for each author with \
\2 {Installation} {installation} \2 {Installation} {installation}
Requirements\: Python (at least 3.9). Requirements\: Python 3.9/* or higher*/.
To install all packages, run\: To install all packages, run\:
@ -170,18 +169,21 @@ To install all packages, run\:
\2 {Map generation} {map-generation} \2 {Map generation} {map-generation}
Command\: \m {render}. Command \m {render} is used to generates SVG map from OpenStreetMap data. You can run it using\:
There are simple Python renderer that generates SVG map from OpenStreetMap data. You can run it using\: \code {roentgen render \\
-b \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\
-o \formal {output file name} \\
-s \formal {osm zoom level} \\
\formal {other arguments}} {bash}
\code {python roentgen.py render \\ \3 {Example} {example-2}
-b $\{LONGITUDE_1\},$\{LATITUDE_1\},$\{LONGITUDE_2\},$\{LATITUDE_2\} \\
-o $\{OUTPUT_FILE_NAME\} \\
-s $\{OSM_ZOOM_LEVEL\}} {bash}
Example\: \code {roentgen render \\
--boundary-box 2.284,48.860,2.290,48.865 \\
--output out/esplanade_du_trocadéro.svg} {bash}
\code {python roentgen.py render -b 2.284,48.86,2.29,48.865} {bash} will download OSM data to \m {cache/2.284,48.860,2.290,48.865.osm} and write output SVG map of the specified area to \m {out/esplanade_du_trocadéro.svg}.
\3 {Arguments} {arguments} \3 {Arguments} {arguments}
@ -189,7 +191,7 @@ Example\:
\2 {Tile generation} {tile-generation} \2 {Tile generation} {tile-generation}
Command\: \m {tile}. Command \m {tile} is used to generate PNG tiles for \ref {https://wiki.openstreetmap.org/wiki/Slippy_Map} {slippy maps}. To use them, run \ref {#tile-server} {Röntgen tile server}.
\options {tile} \options {tile}
@ -197,19 +199,19 @@ Command\: \m {tile}.
Specify tile coordinates\: Specify tile coordinates\:
\code {python roentgen.py tile --tile $\{OSM_ZOOM_LEVEL\}/$\{X\}/$\{Y\}} {bash} \code {roentgen tile --tile \formal {OSM zoom level}/\formal {x}/\formal {y}} {bash}
or specify any geographical coordinates inside a tile\: or specify any geographical coordinates inside a tile\:
\code {python roentgen.py tile \\ \code {roentgen tile \\
--coordinates $\{LATITUDE\},$\{LONGITUDE\} \\ --coordinates \formal {latitude},\formal {longitude} \\
--scale $\{OSM_ZOOM_LEVEL\}} {bash} --scale \formal {OSM zoom level}} {bash}
Tile will be stored as SVG file \m {out/tiles/tile_<zoom level>_<x>_<y>.svg} and PNG file \m {out/tiles/tile_<zoom level>_<x>_<y>.svg}, where \m {x} and \m {y} are tile coordinates. \m {--scale} option will be ignored if it is used with \m {--tile} option. Tile will be stored as SVG file \m {out/tiles/tile_<zoom level>_<x>_<y>.svg} and PNG file \m {out/tiles/tile_<zoom level>_<x>_<y>.svg}, where \m {x} and \m {y} are tile coordinates. \m {--scale} option will be ignored if it is used with \m {--tile} option.
Example\: Example\:
\code {python roentgen.py tile -c 55.7510637,37.6270761 -s 18} {bash} \code {roentgen tile -c 55.7510637,37.6270761 -s 18} {bash}
will generate SVG file \m {out/tiles/tile_18_158471_81953.svg} and PNG file \m {out/tiles/tile_18_158471_81953.png}. will generate SVG file \m {out/tiles/tile_18_158471_81953.svg} and PNG file \m {out/tiles/tile_18_158471_81953.png}.
@ -217,35 +219,41 @@ will generate SVG file \m {out/tiles/tile_18_158471_81953.svg} and PNG file \m {
Specify boundary box to get the minimal set of tiles that covers the area\: Specify boundary box to get the minimal set of tiles that covers the area\:
\code {python roentgen.py tile \\ \code {roentgen tile \\
--boundary-box $\{LONGITUDE_1\},$\{LATITUDE_1\},$\{LONGITUDE_2\},$\{LATITUDE_2\} \\ --boundary-box \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\
--scale $\{OSM_ZOOM_LEVEL\}} {bash} --scale \formal {OSM zoom level}} {bash}
Boundary box will be extended to the boundaries of the minimal tile set that covers the area, then it will be extended a bit more to avoid some artifacts on the edges rounded to 3 digits after the decimal point. Map with new boundary box coordinates will be written to the cache directory as SVG and PNG files. All tiles will be stored as SVG files \m {out/tiles/tile_<zoom level>_<x>_<y>.svg} and PNG files \m {out/tiles/tile_<zoom level>_<x>_<y>.svg}, where \m {x} and \m {y} are tile coordinates. Boundary box will be extended to the boundaries of the minimal tile set that covers the area, then it will be extended a bit more to avoid some artifacts on the edges rounded to 3 digits after the decimal point. Map with new boundary box coordinates will be written to the cache directory as SVG and PNG files. All tiles will be stored as SVG files \m {out/tiles/tile_<zoom level>_<x>_<y>.svg} and PNG files \m {out/tiles/tile_<zoom level>_<x>_<y>.svg}, where \m {x} and \m {y} are tile coordinates.
Example\: Example\:
\code {roentgen.py tile -b 2.361,48.871,2.368,48.875} {bash} \code {roentgen tile -b 2.361,48.871,2.368,48.875} {bash}
will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files \m {cache/2.360,48.869,2.370,48.877.svg} and \m {cache/2.360,48.869,2.370,48.877.png}. will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files \m {cache/2.360,48.869,2.370,48.877.svg} and \m {cache/2.360,48.869,2.370,48.877.png}.
\2 {Tile server} {tile-server}
Command \m {server} is used to run tile server for slippy maps.
\code {roentgen server}
Stop server interrupting process with \kbd {Ctrl} + \kbd {C}.
\2 {MapCSS 0.2 generation} {mapcss-0-2-generation} \2 {MapCSS 0.2 generation} {mapcss-0-2-generation}
Command\: \m {mapcss}. Command \m {mapcss} is used to generate MapCSS scheme. \m {roentgen mapcss} will create \m {out/roentgen_mapcss} directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas\: \m {.mapcss} file and directory with icons.
\m {python roentgen.py mapcss} will create \m {out/roentgen_mapcss} directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas\: \m {.mapcss} file and directory with icons. To create MapCSS with only Röntgen icons run \m {roentgen mapcss --no-ways}.
To create MapCSS with only Röntgen icons run \m {python roentgen.py mapcss --no-ways}.
\options {mapcss} \options {mapcss}
\3 {Use Röntgen as JOSM map paint style} \3 {Use Röntgen as JOSM map paint style}
\list \list
{Run \m {roentgen mapcss}.}
{Open \ref {https://josm.openstreetmap.de/} {JOSM}.} {Open \ref {https://josm.openstreetmap.de/} {JOSM}.}
{Go to \kbd {Preferences} → Third tab on the left → \kbd {Map Paint Styles}.} {Go to \kbd {Preferences} → Third tab on the left → \kbd {Map Paint Styles}.}
{Active styles: press \kbd {+}.} {Active styles: press \kbd {+}.}
{URL / File: set path to \m {out/roentgen_mapcss/roentgen.mapcss}.} {URL / File: set path to \m {out/roentgen_mapcss/roentgen.mapcss}.}
{\kbd {Ok} → \kbd {OK}.}
To enable / disable Röntgen map paint style go to \kbd {View} → \kbd {Map Paint Styles} → \kbd {Röntgen}. To enable / disable Röntgen map paint style go to \kbd {View} → \kbd {Map Paint Styles} → \kbd {Röntgen}.

View file

@ -29,17 +29,14 @@ def parse_text(text: str, margins: str, tag_id: str) -> Code:
result: Code = [] result: Code = []
inside: bool = False inside: bool = False
for c in text: for character in text:
if c in margins: if character not in margins:
if word: word += character
if not inside: continue
result.append(word) if word:
else: result.append(Tag(tag_id, [word]) if inside else word)
result.append(Tag(tag_id, [word])) word = ""
word = "" inside = not inside
inside = not inside
else:
word += c
if word: if word:
result.append(word) result.append(word)
@ -208,6 +205,10 @@ class RoentgenMoire(Default, ABC):
"""Keyboard key.""" """Keyboard key."""
return self.m(args) return self.m(args)
def no_wrap(self, args: Arguments) -> str:
"""Do not wrap text at white spaces."""
return self.parse(args[0])
class RoentgenHTML(RoentgenMoire, DefaultHTML): class RoentgenHTML(RoentgenMoire, DefaultHTML):
""" """
@ -219,6 +220,7 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML):
self.images: dict = {} self.images: dict = {}
def table(self, arg: Arguments) -> str: def table(self, arg: Arguments) -> str:
"""Simple table. First row is treated as header."""
content: str = "" content: str = ""
cell: str = "".join( cell: str = "".join(
["<th>" + self.parse(td, inblock=True) + "</th>" for td in arg[0]] ["<th>" + self.parse(td, inblock=True) + "</th>" for td in arg[0]]
@ -252,7 +254,10 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML):
def page_icon(self, args: Arguments) -> str: def page_icon(self, args: Arguments) -> str:
"""HTML page icon.""" """HTML page icon."""
return f'<link rel="icon" type="image/svg" href="{self.clear(args[0])}" sizes="16x16">' return (
f'<link rel="icon" type="image/svg" href="{self.clear(args[0])}"'
' sizes="16x16">'
)
def no_wrap(self, args: Arguments) -> str: def no_wrap(self, args: Arguments) -> str:
"""Do not wrap text at white spaces.""" """Do not wrap text at white spaces."""
@ -261,6 +266,7 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML):
) )
def formal(self, args: Arguments) -> str: def formal(self, args: Arguments) -> str:
"""Formal variable."""
return f'<span class="formal">{self.parse(args[0])}</span>' return f'<span class="formal">{self.parse(args[0])}</span>'
@ -323,3 +329,7 @@ class RoentgenMarkdown(RoentgenMoire, DefaultMarkdown):
return ( return (
f'<span style="white-space: nowrap;">{self.parse(args[0])}</span>' f'<span style="white-space: nowrap;">{self.parse(args[0])}</span>'
) )
def formal(self, args: Arguments) -> str:
"""Formal variable."""
return f"<{self.parse(args[0])}>"

View file

@ -123,8 +123,8 @@ def add_render_arguments(parser: argparse.ArgumentParser) -> None:
"-b", "-b",
"--boundary-box", "--boundary-box",
metavar="<lon1>,<lat1>,<lon2>,<lat2>", metavar="<lon1>,<lat1>,<lon2>,<lat2>",
help='geo boundary box, use space before "-" if the first value is ' help="geo boundary box; if first value is negative, enclose the value "
"negative", "with quotes and use space before `-`",
) )
parser.add_argument( parser.add_argument(
"-s", "-s",