mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-03 04:06:41 +02:00
Rename Röntgen to Map Machine.
This commit is contained in:
parent
38c4e00de3
commit
2bd89a6539
57 changed files with 252 additions and 236 deletions
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -1,7 +1,7 @@
|
|||
Contributing
|
||||
============
|
||||
|
||||
Thank you for your interest in the Röntgen project. Since the primary goal of the project is to cover as many tags as possible, the project is crucially depend on contributions as OpenStreetMap itself.
|
||||
Thank you for your interest in the Map Machine project. Since the primary goal of the project is to cover as many tags as possible, the project is crucially depend on contributions as OpenStreetMap itself.
|
||||
|
||||
Suggest a tag to support
|
||||
------------------------
|
||||
|
|
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
|||
pip install .
|
||||
- name: Check code style with Black
|
||||
run: |
|
||||
black -l 80 --check roentgen tests
|
||||
black -l 80 --check map_machine tests
|
||||
- name: Lint with Flake8
|
||||
run: |
|
||||
flake8 --max-line-length=80 --ignore=E203,W503
|
||||
|
@ -32,16 +32,16 @@ jobs:
|
|||
pytest -v
|
||||
- name: Test render
|
||||
run: |
|
||||
roentgen render -b 10.000,20.000,10.001,20.001 --cache tests/data
|
||||
map-machine render -b 10.000,20.000,10.001,20.001 --cache tests/data
|
||||
- name: Test icon generation
|
||||
run: |
|
||||
roentgen icons
|
||||
map-machine icons
|
||||
- name: Test MapCSS 0.2 generation
|
||||
run: |
|
||||
roentgen mapcss
|
||||
map-machine mapcss
|
||||
- name: Test element generation
|
||||
run: |
|
||||
roentgen element --node amenity=bench,material=wood
|
||||
map-machine element --node amenity=bench,material=wood
|
||||
- name: Test tile generation
|
||||
run: |
|
||||
roentgen tile --coordinates 50.000,40.000 --cache tests/data
|
||||
map-machine tile --coordinates 50.000,40.000 --cache tests/data
|
||||
|
|
65
README.md
65
README.md
|
@ -1,27 +1,27 @@
|
|||
|
||||
|
||||
**Röntgen** (or **Roentgen** when ASCII is preferred) project consists of
|
||||
**Map Machine** project consists of
|
||||
|
||||
* simple Python [OpenStreetMap](http://openstreetmap.org) renderer and tile generator (see [usage](#usage-example), [renderer documentation](#map-generation), [tile generation](#tile-generation)),
|
||||
* [set of CC-BY 4.0 icons](#icon-set) that can be used outside the project.
|
||||
* [Röntgen icon set](#icon-set): unique CC-BY 4.0 icons.
|
||||
|
||||
The idea behind the Röntgen project is to **show all the richness of the OpenStreetMap data**: to have a possibility to *display any map feature* represented by OpenStreetMap data tags by means of colors, shapes, and icons. Röntgen is created for OpenStreetMap contributors: to display all changes one made on the map even if they are small, and for users: to dig down into the map and find every detail that was mapped.
|
||||
The idea behind the Map Machine project is to **show all the richness of the OpenStreetMap data**: to have a possibility to *display any map feature* represented by OpenStreetMap data tags by means of colors, shapes, and icons. Map Machine is created for OpenStreetMap contributors: to display all changes one made on the map even if they are small, and for users: to dig down into the map and find every detail that was mapped.
|
||||
|
||||
Unlike standard OpenStreetMap layers, **Röntgen is a playground for experiments** where one can easily try to support proposed tags, tags with little or even single usage, deprecated tags.
|
||||
Unlike standard OpenStreetMap layers, **Map Machine is a playground for experiments** where one can easily try to support proposed tags, tags with little or even single usage, deprecated tags.
|
||||
|
||||
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.
|
||||
Map Machine 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 example
|
||||
-------------
|
||||
|
||||
```bash
|
||||
roentgen render -b 2.284,48.860,2.290,48.865
|
||||
map-machine render -b 2.284,48.860,2.290,48.865
|
||||
```
|
||||
|
||||
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
|
||||
map-machine 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).
|
||||
|
@ -29,7 +29,7 @@ will automatically download OSM data and write output PNG tiles that cover the s
|
|||
Map features
|
||||
------------
|
||||
|
||||
Röntgen features:
|
||||
Map Machine features:
|
||||
|
||||
* detailed icons to display subtypes like [power tower design](#power-tower-design),
|
||||
* can display multiple icons for one entity to cover more features,
|
||||
|
@ -77,21 +77,21 @@ There are [special symbols](https://en.wikipedia.org/wiki/List_of_Japanese_map_s
|
|||
Icon set
|
||||
--------
|
||||
|
||||
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.
|
||||
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 Map Machine 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`](https://wiki.openstreetmap.org/wiki/Key:material) or [`genus`](https://wiki.openstreetmap.org/wiki/Key:genus)).
|
||||
Icons are used to visualize tags for nodes and areas. Unlike other renderers, Map Machine 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`](https://wiki.openstreetmap.org/wiki/Key:material) or [`genus`](https://wiki.openstreetmap.org/wiki/Key:genus)).
|
||||
|
||||

|
||||
|
||||
Feel free to request new icons via issues for whatever you want to see on the map. No matter how frequently the tag is used in OpenStreetMap since final goal is to cover all tags. However, common used tags have priority, other things being equal.
|
||||
|
||||
Generate icon grid and sets of individual icons with `roentgen 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 `map-machine 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)).
|
||||
|
||||
### Shape combination ###
|
||||
|
||||
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.
|
||||
Map Machine 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.
|
||||
|
||||

|
||||
|
||||
|
@ -128,7 +128,7 @@ Map generation
|
|||
Command `render` is used to generates SVG map from OpenStreetMap data. You can run it using:
|
||||
|
||||
```bash
|
||||
roentgen render \
|
||||
map-machine render \
|
||||
-b <min longitude>,<min latitude>,<max longitude>,<max latitude> \
|
||||
-o <output file name> \
|
||||
-z <OSM zoom level> \
|
||||
|
@ -138,7 +138,7 @@ roentgen render \
|
|||
### Example ###
|
||||
|
||||
```bash
|
||||
roentgen render \
|
||||
map-machine render \
|
||||
--boundary-box 2.284,48.860,2.290,48.865 \
|
||||
--output out/esplanade_du_trocadéro.svg
|
||||
```
|
||||
|
@ -160,7 +160,7 @@ plus [map configuration options](#map-options)
|
|||
Tile generation
|
||||
---------------
|
||||
|
||||
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).
|
||||
Command `tile` is used to generate PNG tiles for [slippy maps](https://wiki.openstreetmap.org/wiki/Slippy_Map). To use them, run [Map Machine tile server](#tile-server).
|
||||
|
||||
| Option | Description |
|
||||
|---|---|
|
||||
|
@ -169,6 +169,7 @@ Command `tile` is used to generate PNG tiles for [slippy maps](https://wiki.open
|
|||
| <span style="white-space: nowrap;">`--cache`</span> `<path>` | path for temporary OSM files, default value: `cache` |
|
||||
| <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 |
|
||||
| <span style="white-space: nowrap;">`-z`</span>, <span style="white-space: nowrap;">`--zoom`</span> `<integer>` | OSM zoom levels; can be list of numbers or ranges, e.g. `16-18`, `16,17,18`, or `16,18-20`, default value: `18` |
|
||||
| <span style="white-space: nowrap;">`-i`</span>, <span style="white-space: nowrap;">`--input`</span> `<path>` | input OSM XML file name (if not specified, file will be downloaded using OpenStreetMap API) |
|
||||
|
||||
plus [map configuration options](#map-options)
|
||||
|
||||
|
@ -177,13 +178,13 @@ plus [map configuration options](#map-options)
|
|||
Specify tile coordinates:
|
||||
|
||||
```bash
|
||||
roentgen tile --tile <OSM zoom level>/<x>/<y>
|
||||
map-machine tile --tile <OSM zoom level>/<x>/<y>
|
||||
```
|
||||
|
||||
or specify any geographical coordinates inside a tile:
|
||||
|
||||
```bash
|
||||
roentgen tile \
|
||||
map-machine tile \
|
||||
--coordinates <latitude>,<longitude> \
|
||||
--zoom <OSM zoom levels>
|
||||
```
|
||||
|
@ -193,7 +194,7 @@ Tile will be stored as SVG file `out/tiles/tile_<zoom level>_<x>_<y>.svg` and PN
|
|||
Example:
|
||||
|
||||
```bash
|
||||
roentgen tile -c 55.7510637,37.6270761 -z 18
|
||||
map-machine tile -c 55.7510637,37.6270761 -z 18
|
||||
```
|
||||
|
||||
will generate SVG file `out/tiles/tile_18_158471_81953.svg` and PNG file `out/tiles/tile_18_158471_81953.png`.
|
||||
|
@ -203,7 +204,7 @@ 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:
|
||||
|
||||
```bash
|
||||
roentgen tile \
|
||||
map-machine tile \
|
||||
--boundary-box <min longitude>,<min latitude>,<max longitude>,<max latitude> \
|
||||
--zoom <OSM zoom levels>
|
||||
```
|
||||
|
@ -213,7 +214,7 @@ Boundary box will be extended to the boundaries of the minimal tile set that cov
|
|||
Example:
|
||||
|
||||
```bash
|
||||
roentgen tile -b 2.361,48.871,2.368,48.875
|
||||
map-machine tile -b 2.361,48.871,2.368,48.875
|
||||
```
|
||||
|
||||
will generate 36 PNG tiles at zoom level 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_18.svg` and `cache/2.360,48.869,2.370,48.877_18.png`.
|
||||
|
@ -224,7 +225,7 @@ Tile server
|
|||
Command `server` is used to run tile server for slippy maps.
|
||||
|
||||
```
|
||||
roentgen server
|
||||
map-machine server
|
||||
```
|
||||
|
||||
Stop server interrupting process with <kbd>Ctrl</kbd> + <kbd>C</kbd>.
|
||||
|
@ -239,13 +240,13 @@ Stop server interrupting process with <kbd>Ctrl</kbd> + <kbd>C</kbd>.
|
|||
Create a minimal amount of tiles that cover specified boundary box for zoom levels 16, 17, 18, and 19:
|
||||
|
||||
```bash
|
||||
roentgen tile -b 2.364,48.854,2.367,48.857 -z 16-19
|
||||
map-machine tile -b 2.364,48.854,2.367,48.857 -z 16-19
|
||||
```
|
||||
|
||||
Run tile server on 127.0.0.1:8080:
|
||||
|
||||
```bash
|
||||
roentgen server
|
||||
map-machine server
|
||||
```
|
||||
|
||||
Use JavaScript code for [Leaflet](https://leafletjs.com/):
|
||||
|
@ -258,8 +259,8 @@ L.tileLayer('http://127.0.0.1:8080/tiles/{z}/{x}/{y}', {
|
|||
attribution: 'Map data © ' +
|
||||
'<a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
|
||||
'contributors, imagery © ' +
|
||||
'<a href="https:/github.com/enzet/Roentgen">Röntgen</a>',
|
||||
id: 'roentgen',
|
||||
'<a href="https:/github.com/enzet/map-machine">Map Machine</a>',
|
||||
id: 'map_machine',
|
||||
tileSize: 256,
|
||||
zoomOffset: 0
|
||||
}).addTo(map);
|
||||
|
@ -288,9 +289,9 @@ Map configuration options used by `render` and `tile` commands:
|
|||
MapCSS 0.2 generation
|
||||
---------------------
|
||||
|
||||
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.
|
||||
Command `mapcss` is used to generate MapCSS scheme. `map-machine mapcss` will create `out/map_machine_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 Röntgen style also for ways and relations, run `roentgen mapcss --ways`.
|
||||
To create MapCSS with Map Machine style also for ways and relations, run `map-machine mapcss --ways`.
|
||||
|
||||
| Option | Description |
|
||||
|---|---|
|
||||
|
@ -298,15 +299,15 @@ To create MapCSS with Röntgen style also for ways and relations, run `roentgen
|
|||
| <span style="white-space: nowrap;">`--ways`</span> | add style for ways and relations |
|
||||
| <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 Map Machine as JOSM map paint style ###
|
||||
|
||||
* Run `roentgen mapcss`.
|
||||
* Run `map-machine mapcss`.
|
||||
* Open [JOSM](https://josm.openstreetmap.de/).
|
||||
* Go to <kbd>Preferences</kbd> → Third tab on the left → <kbd>Map Paint Styles</kbd>.
|
||||
* Active styles: press <kbd>+</kbd>.
|
||||
* URL / File: set path to `out/roentgen_mapcss/roentgen.mapcss`.
|
||||
* URL / File: set path to `out/map_machine_mapcss/map_machine.mapcss`.
|
||||
|
||||
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 Map Machine map paint style go to <kbd>View</kbd> → <kbd>Map Paint Styles</kbd> → <kbd>Map Machine</kbd>.
|
||||
|
||||
#### Example ####
|
||||
|
||||
|
@ -315,5 +316,5 @@ To enable / disable Röntgen map paint style go to <kbd>View</kbd> → <kbd>Map
|
|||
Example of using Röntgen icons on top of Mapnik style in JOSM. Map Paint Styles look like:
|
||||
|
||||
* ✓ Mapnik (true)
|
||||
* ✓ Röntgen
|
||||
* ✓ Map Machine
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "Checking code format with Black..."
|
||||
if ! black -l 80 --check tests roentgen; then
|
||||
black -l 80 --diff tests roentgen
|
||||
if ! black -l 80 --check tests map_machine; then
|
||||
black -l 80 --diff tests map_machine
|
||||
echo "FAIL"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -10,8 +10,8 @@ else
|
|||
fi
|
||||
|
||||
echo "Checking code format with Black..."
|
||||
if ! black -l 80 --check tests roentgen; then
|
||||
black -l 80 --diff tests roentgen
|
||||
if ! black -l 80 --check tests map_machine; then
|
||||
black -l 80 --diff tests map_machine
|
||||
echo "FAIL"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -33,22 +33,22 @@ pytest -v || { echo "FAIL"; exit 1; }
|
|||
# Integration tests.
|
||||
|
||||
echo "Test render"
|
||||
python3 roentgen render -b 10.000,20.000,10.001,20.001 --cache tests/data \
|
||||
map-machine render -b 10.000,20.000,10.001,20.001 --cache tests/data \
|
||||
|| { echo "FAIL"; exit 1; }
|
||||
grep "natural: tree" out/map.svg || { echo "FAIL"; exit 1; }
|
||||
|
||||
echo "Test icons"
|
||||
python3 roentgen icons || { echo "FAIL"; exit 1; }
|
||||
map-machine icons || { echo "FAIL"; exit 1; }
|
||||
|
||||
echo "Test MapCSS generation"
|
||||
python3 roentgen mapcss || { echo "FAIL"; exit 1; }
|
||||
map-machine mapcss || { echo "FAIL"; exit 1; }
|
||||
|
||||
echo "Test element generation"
|
||||
python3 roentgen element --node amenity=bench,material=wood \
|
||||
map-machine element --node amenity=bench,material=wood \
|
||||
|| { echo "FAIL"; exit 1; }
|
||||
|
||||
echo "Test tile generation"
|
||||
python3 roentgen tile --coordinates 50.000,40.000 --cache tests/data \
|
||||
map-machine tile --coordinates 50.000,40.000 --cache tests/data \
|
||||
|| { echo "FAIL"; exit 1; }
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
\1 {Contributing} {contributing}
|
||||
|
||||
Thank you for your interest in the Röntgen project. Since the primary goal of the project is to cover as many tags as possible, the project is crucially depend on contributions as OpenStreetMap itself.
|
||||
Thank you for your interest in the Map Machine project. Since the primary goal of the project is to cover as many tags as possible, the project is crucially depend on contributions as OpenStreetMap itself.
|
||||
|
||||
\2 {Suggest a tag to support} {}
|
||||
|
||||
|
@ -17,7 +17,7 @@ Please, create an issue with \m {bug} and \m {generator} labels.
|
|||
/*
|
||||
\2 {Fix a typo in documentation} {}
|
||||
|
||||
This action is not that easy as it supposed to be. We use \ref {http://github.com/enzet/Moire} {Moire} markup and converter to automatically generate documentation for GitHub, website, and \ref {http://wiki.openstreetmap.org/} {OpenStreetMap wiki}. That's why editing Markdown files is not allowed. To fix a typo, open corresponding Moire file in \m {doc} directory (e.g. \m {doc/readme.moi} for \m {README.md}), modify it, and run \m {python roentgen doc} script.
|
||||
This action is not that easy as it supposed to be. We use \ref {http://github.com/enzet/Moire} {Moire} markup and converter to automatically generate documentation for GitHub, website, and \ref {http://wiki.openstreetmap.org/} {OpenStreetMap wiki}. That's why editing Markdown files is not allowed. To fix a typo, open corresponding Moire file in \m {doc} directory (e.g. \m {doc/readme.moi} for \m {README.md}), modify it, and run \m {map-machine doc} script.
|
||||
*/
|
||||
|
||||
\2 {Modify the code} {}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
\title {Röntgen}
|
||||
\title {Map Machine}
|
||||
\page_icon {out/icons_by_id/book.svg}
|
||||
|
||||
\b {Röntgen} (or \b {Roentgen} when ASCII is preferred) project consists of
|
||||
\b {Map Machine} project consists of
|
||||
|
||||
\list
|
||||
{simple Python \ref {http://openstreetmap.org} {OpenStreetMap} renderer and tile generator (see \ref {#usage-example} {usage}, \ref {#map-generation} {renderer documentation}, \ref {#tile-generation} {tile generation}),}
|
||||
{\ref {#icon-set} {set of CC-BY 4.0 icons} that can be used outside the project.}
|
||||
{\ref {#icon-set} {Röntgen icon set}\: unique CC-BY 4.0 icons.}
|
||||
|
||||
The idea behind the Röntgen project is to \b {show all the richness of the OpenStreetMap data}\: to have a possibility to \i {display any map feature} represented by OpenStreetMap data tags by means of colors, shapes, and icons. Röntgen is created for OpenStreetMap contributors\: to display all changes one made on the map even if they are small, and for users\: to dig down into the map and find every detail that was mapped.
|
||||
The idea behind the Map Machine project is to \b {show all the richness of the OpenStreetMap data}\: to have a possibility to \i {display any map feature} represented by OpenStreetMap data tags by means of colors, shapes, and icons. Map Machine is created for OpenStreetMap contributors\: to display all changes one made on the map even if they are small, and for users\: to dig down into the map and find every detail that was mapped.
|
||||
|
||||
Unlike standard OpenStreetMap layers, \b {Röntgen is a playground for experiments} where one can easily try to support proposed tags, tags with little or even single usage, deprecated tags.
|
||||
Unlike standard OpenStreetMap layers, \b {Map Machine is a playground for experiments} where one can easily try to support proposed tags, tags with little or even single usage, deprecated tags.
|
||||
|
||||
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.
|
||||
Map Machine 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 example} {usage-example}
|
||||
|
||||
\code {roentgen render -b 2.284,48.860,2.290,48.865} {bash}
|
||||
\code {map-machine render -b 2.284,48.860,2.290,48.865} {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}.
|
||||
|
||||
\code {roentgen tile -b 2.361,48.871,2.368,48.875} {bash}
|
||||
\code {map-machine 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}
|
||||
|
||||
Röntgen features\:
|
||||
Map Machine features\:
|
||||
\list
|
||||
{detailed icons to display subtypes like \ref {#power-tower-design} {power tower design},}
|
||||
{can display multiple icons for one entity to cover more features,}
|
||||
|
@ -89,11 +89,11 @@ There are \ref {https://en.wikipedia.org/wiki/List_of_Japanese_map_symbols} {spe
|
|||
|
||||
\2 {Icon set} {icon-set}
|
||||
|
||||
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.
|
||||
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 Map Machine 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 \osm {material} or \osm {genus}).
|
||||
Icons are used to visualize tags for nodes and areas. Unlike other renderers, Map Machine can use more than one icon to visualize an entity and use colors to visualize \osm {colour} value or other entity properties (like \osm {material} or \osm {genus}).
|
||||
|
||||
\image {doc/grid.png} {Icons}
|
||||
|
||||
|
@ -103,7 +103,7 @@ Generate icon grid and sets of individual icons with \m {\command {Test icon gen
|
|||
|
||||
\3 {Shape combination} {shape_combination}
|
||||
|
||||
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.
|
||||
Map Machine 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}
|
||||
|
||||
|
@ -172,7 +172,7 @@ pip install .} {bash}
|
|||
|
||||
Command \m {render} is used to generates SVG map from OpenStreetMap data. You can run it using\:
|
||||
|
||||
\code {roentgen render \\
|
||||
\code {map-machine render \\
|
||||
-b \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\
|
||||
-o \formal {output file name} \\
|
||||
-z \formal {OSM zoom level} \\
|
||||
|
@ -180,7 +180,7 @@ Command \m {render} is used to generates SVG map from OpenStreetMap data. You c
|
|||
|
||||
\3 {Example} {example-2}
|
||||
|
||||
\code {roentgen render \\
|
||||
\code {map-machine render \\
|
||||
--boundary-box 2.284,48.860,2.290,48.865 \\
|
||||
--output out/esplanade_du_trocadéro.svg} {bash}
|
||||
|
||||
|
@ -194,7 +194,7 @@ plus \ref {#map-options} {map configuration options}
|
|||
|
||||
\2 {Tile generation} {tile-generation}
|
||||
|
||||
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}.
|
||||
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} {Map Machine tile server}.
|
||||
|
||||
\options {tile}
|
||||
|
||||
|
@ -204,11 +204,11 @@ plus \ref {#map-options} {map configuration options}
|
|||
|
||||
Specify tile coordinates\:
|
||||
|
||||
\code {roentgen tile --tile \formal {OSM zoom level}/\formal {x}/\formal {y}} {bash}
|
||||
\code {map-machine tile --tile \formal {OSM zoom level}/\formal {x}/\formal {y}} {bash}
|
||||
|
||||
or specify any geographical coordinates inside a tile\:
|
||||
|
||||
\code {roentgen tile \\
|
||||
\code {map-machine tile \\
|
||||
--coordinates \formal {latitude},\formal {longitude} \\
|
||||
--zoom \formal {OSM zoom levels}} {bash}
|
||||
|
||||
|
@ -216,7 +216,7 @@ Tile will be stored as SVG file \m {out/tiles/tile_<zoom level>_<x>_<y>.svg} and
|
|||
|
||||
Example\:
|
||||
|
||||
\code {roentgen tile -c 55.7510637,37.6270761 -z 18} {bash}
|
||||
\code {map-machine tile -c 55.7510637,37.6270761 -z 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}.
|
||||
|
||||
|
@ -224,7 +224,7 @@ 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\:
|
||||
|
||||
\code {roentgen tile \\
|
||||
\code {map-machine tile \\
|
||||
--boundary-box \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\
|
||||
--zoom \formal {OSM zoom levels}} {bash}
|
||||
|
||||
|
@ -232,7 +232,7 @@ Boundary box will be extended to the boundaries of the minimal tile set that cov
|
|||
|
||||
Example\:
|
||||
|
||||
\code {roentgen tile -b 2.361,48.871,2.368,48.875} {bash}
|
||||
\code {map-machine tile -b 2.361,48.871,2.368,48.875} {bash}
|
||||
|
||||
will generate 36 PNG tiles at zoom level 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_18.svg} and \m {cache/2.360,48.869,2.370,48.877_18.png}.
|
||||
|
||||
|
@ -240,7 +240,7 @@ will generate 36 PNG tiles at zoom level 18 from tile 18/132791/90164 all the wa
|
|||
|
||||
Command \m {server} is used to run tile server for slippy maps.
|
||||
|
||||
\code {roentgen server}
|
||||
\code {map-machine server}
|
||||
|
||||
Stop server interrupting process with \kbd {Ctrl} + \kbd {C}.
|
||||
|
||||
|
@ -250,11 +250,11 @@ Stop server interrupting process with \kbd {Ctrl} + \kbd {C}.
|
|||
|
||||
Create a minimal amount of tiles that cover specified boundary box for zoom levels 16, 17, 18, and 19\:
|
||||
|
||||
\code {roentgen tile -b 2.364,48.854,2.367,48.857 -z 16-19} {bash}
|
||||
\code {map-machine tile -b 2.364,48.854,2.367,48.857 -z 16-19} {bash}
|
||||
|
||||
Run tile server on 127.0.0.1\:8080\:
|
||||
|
||||
\code {roentgen server} {bash}
|
||||
\code {map-machine server} {bash}
|
||||
|
||||
Use JavaScript code for \ref {https://leafletjs.com/} {Leaflet}\:
|
||||
|
||||
|
@ -265,8 +265,8 @@ L.tileLayer('http://127.0.0.1:8080/tiles/\{z\}/\{x\}/\{y\}', \{
|
|||
attribution: 'Map data © ' +
|
||||
'<a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
|
||||
'contributors, imagery © ' +
|
||||
'<a href="https:/github.com/enzet/Roentgen">Röntgen</a>',
|
||||
id: 'roentgen',
|
||||
'<a href="https:/github.com/enzet/map-machine">Map Machine</a>',
|
||||
id: 'map_machine',
|
||||
tileSize: 256,
|
||||
zoomOffset: 0
|
||||
\}).addTo(map);} {js}
|
||||
|
@ -283,22 +283,22 @@ Map configuration options used by \m {render} and \m {tile} commands:
|
|||
|
||||
\2 {MapCSS 0.2 generation} {mapcss-0-2-generation}
|
||||
|
||||
Command \m {mapcss} is used to generate MapCSS scheme. \m {\command {Test MapCSS 0.2 generation}} 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.
|
||||
Command \m {mapcss} is used to generate MapCSS scheme. \m {\command {Test MapCSS 0.2 generation}} will create \m {out/map_machine_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 Röntgen style also for ways and relations, run \m {roentgen mapcss --ways}.
|
||||
To create MapCSS with Map Machine style also for ways and relations, run \m {map-machine mapcss --ways}.
|
||||
|
||||
\options {mapcss}
|
||||
|
||||
\3 {Use Röntgen as JOSM map paint style}
|
||||
\3 {Use Map Machine as JOSM map paint style}
|
||||
|
||||
\list
|
||||
{Run \m {\command {Test MapCSS 0.2 generation}}.}
|
||||
{Open \ref {https://josm.openstreetmap.de/} {JOSM}.}
|
||||
{Go to \kbd {Preferences} → Third tab on the left → \kbd {Map Paint Styles}.}
|
||||
{Active styles: press \kbd {+}.}
|
||||
{URL / File: set path to \m {out/roentgen_mapcss/roentgen.mapcss}.}
|
||||
{URL / File: set path to \m {out/map_machine_mapcss/map_machine.mapcss}.}
|
||||
|
||||
To enable / disable Röntgen map paint style go to \kbd {View} → \kbd {Map Paint Styles} → \kbd {Röntgen}.
|
||||
To enable / disable Map Machine map paint style go to \kbd {View} → \kbd {Map Paint Styles} → \kbd {Map Machine}.
|
||||
|
||||
\4 {Example}
|
||||
|
||||
|
@ -307,4 +307,4 @@ To enable / disable Röntgen map paint style go to \kbd {View} → \kbd {Map Pai
|
|||
Example of using Röntgen icons on top of Mapnik style in JOSM. Map Paint Styles look like\:
|
||||
\list
|
||||
{✓ Mapnik (true)}
|
||||
{✓ Röntgen}
|
||||
{✓ Map Machine}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""
|
||||
Röntgen project: simple Python map renderer for OpenStreetMap and icon set.
|
||||
Map Machine project: simple Python map renderer for OpenStreetMap and icon set.
|
||||
"""
|
||||
|
||||
__project__ = "Röntgen"
|
||||
__project__ = "Map Machine"
|
||||
__description__ = (
|
||||
"Simple Python map renderer for OpenStreetMap with custom icon set "
|
||||
"intended to display as many tags as possible"
|
||||
)
|
||||
__url__ = "https://github.com/enzet/Roentgen"
|
||||
__url__ = "https://github.com/enzet/map-machine"
|
||||
__doc_url__ = f"{__url__}/blob/main/README.md"
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
7
map_machine/__main__.py
Normal file
7
map_machine/__main__.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
"""
|
||||
Map Machine entry point.
|
||||
"""
|
||||
from map_machine.main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -5,7 +5,7 @@ from typing import Any
|
|||
|
||||
from colour import Color
|
||||
|
||||
from roentgen.util import MinMax
|
||||
from map_machine.util import MinMax
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Construct Röntgen nodes and ways.
|
||||
Construct Map Machine nodes and ways.
|
||||
"""
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
@ -9,9 +9,9 @@ from typing import Any, Iterator, Optional, Union
|
|||
import numpy as np
|
||||
from colour import Color
|
||||
|
||||
from roentgen import ui
|
||||
from roentgen.color import get_gradient_color
|
||||
from roentgen.figure import (
|
||||
from map_machine import ui
|
||||
from map_machine.color import get_gradient_color
|
||||
from map_machine.figure import (
|
||||
Building,
|
||||
Crater,
|
||||
DirectionSector,
|
||||
|
@ -19,20 +19,20 @@ from roentgen.figure import (
|
|||
StyledFigure,
|
||||
Tree,
|
||||
)
|
||||
from roentgen.flinger import Flinger
|
||||
from roentgen.map_configuration import DrawingMode, MapConfiguration
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.map_configuration import DrawingMode, MapConfiguration
|
||||
|
||||
# fmt: off
|
||||
from roentgen.icon import (
|
||||
from map_machine.icon import (
|
||||
DEFAULT_SMALL_SHAPE_ID, Icon, IconSet, Shape, ShapeExtractor,
|
||||
ShapeSpecification
|
||||
)
|
||||
from roentgen.osm_reader import OSMData, OSMNode, OSMRelation, OSMWay
|
||||
from roentgen.point import Point
|
||||
from roentgen.scheme import DEFAULT_COLOR, LineStyle, RoadMatcher, Scheme
|
||||
from roentgen.text import Label
|
||||
from roentgen.ui import BuildingMode
|
||||
from roentgen.util import MinMax
|
||||
from map_machine.osm_reader import OSMData, OSMNode, OSMRelation, OSMWay
|
||||
from map_machine.point import Point
|
||||
from map_machine.scheme import DEFAULT_COLOR, LineStyle, RoadMatcher, Scheme
|
||||
from map_machine.text import Label
|
||||
from map_machine.ui import BuildingMode
|
||||
from map_machine.util import MinMax
|
||||
# fmt: on
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
@ -147,7 +147,7 @@ def try_to_glue(
|
|||
|
||||
class Constructor:
|
||||
"""
|
||||
Röntgen node and way constructor.
|
||||
Map Machine node and way constructor.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
@ -199,7 +199,7 @@ class Constructor:
|
|||
self.construct_nodes()
|
||||
|
||||
def construct_ways(self) -> None:
|
||||
"""Construct Röntgen ways."""
|
||||
"""Construct Map Machine ways."""
|
||||
for index, way_id in enumerate(self.osm_data.ways):
|
||||
ui.progress_bar(
|
||||
index,
|
||||
|
@ -349,7 +349,7 @@ class Constructor:
|
|||
)
|
||||
|
||||
def construct_relations(self) -> None:
|
||||
"""Construct Röntgen ways from OSM relations."""
|
||||
"""Construct Map Machine ways from OSM relations."""
|
||||
for relation_id in self.osm_data.relations:
|
||||
relation: OSMRelation = self.osm_data.relations[relation_id]
|
||||
tags: dict[str, str] = relation.tags
|
|
@ -6,7 +6,7 @@ from typing import Iterator, Optional
|
|||
import numpy as np
|
||||
from portolan import middle
|
||||
|
||||
from roentgen.drawing import PathCommands
|
||||
from map_machine.drawing import PathCommands
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -9,11 +9,11 @@ import numpy as np
|
|||
import svgwrite
|
||||
from svgwrite.path import Path as SVGPath
|
||||
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from roentgen.point import Point
|
||||
from roentgen.scheme import LineStyle, Scheme
|
||||
from roentgen.text import Label
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.point import Point
|
||||
from map_machine.scheme import LineStyle, Scheme
|
||||
from map_machine.text import Label
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -9,12 +9,12 @@ from svgwrite import Drawing
|
|||
from svgwrite.container import Group
|
||||
from svgwrite.path import Path
|
||||
|
||||
from roentgen.direction import DirectionSet, Sector
|
||||
from roentgen.drawing import PathCommands
|
||||
from roentgen.flinger import Flinger
|
||||
from roentgen.osm_reader import OSMNode, Tagged
|
||||
from roentgen.road import Lane
|
||||
from roentgen.scheme import LineStyle, RoadMatcher, Scheme
|
||||
from map_machine.direction import DirectionSet, Sector
|
||||
from map_machine.drawing import PathCommands
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.osm_reader import OSMNode, Tagged
|
||||
from map_machine.road import Lane
|
||||
from map_machine.scheme import LineStyle, RoadMatcher, Scheme
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -5,7 +5,7 @@ from typing import Optional
|
|||
|
||||
import numpy as np
|
||||
|
||||
from roentgen.boundary_box import BoundaryBox
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -11,9 +11,9 @@ from colour import Color
|
|||
from svgwrite import Drawing
|
||||
from svgwrite.shapes import Rect
|
||||
|
||||
from roentgen.icon import Icon, Shape, ShapeExtractor, ShapeSpecification
|
||||
from roentgen.scheme import NodeMatcher, Scheme
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine.icon import Icon, Shape, ShapeExtractor, ShapeSpecification
|
||||
from map_machine.scheme import NodeMatcher, Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -18,7 +18,7 @@ from svgwrite.base import BaseElement
|
|||
from svgwrite.container import Group
|
||||
from svgwrite.path import Path as SVGPath
|
||||
|
||||
from roentgen.color import is_bright
|
||||
from map_machine.color import is_bright
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
@ -1,20 +1,20 @@
|
|||
"""
|
||||
Röntgen entry point.
|
||||
Map Machine entry point.
|
||||
"""
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from roentgen.ui import parse_options
|
||||
from roentgen.workspace import Workspace
|
||||
from map_machine.ui import parse_options
|
||||
from map_machine.workspace import Workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Röntgen command-line entry point."""
|
||||
"""Map Machine command-line entry point."""
|
||||
logging.basicConfig(format="%(levelname)s %(message)s", level=logging.INFO)
|
||||
workspace: Workspace = Workspace(Path("out"))
|
||||
|
||||
|
@ -24,38 +24,38 @@ def main() -> None:
|
|||
print("No command provided. See --help.")
|
||||
|
||||
elif arguments.command == "render":
|
||||
from roentgen import mapper
|
||||
from map_machine import mapper
|
||||
|
||||
mapper.ui(arguments)
|
||||
|
||||
elif arguments.command == "tile":
|
||||
from roentgen import tile
|
||||
from map_machine import tile
|
||||
|
||||
tile.ui(arguments)
|
||||
|
||||
elif arguments.command == "icons":
|
||||
from roentgen.grid import draw_icons
|
||||
from map_machine.grid import draw_icons
|
||||
|
||||
draw_icons()
|
||||
|
||||
elif arguments.command == "mapcss":
|
||||
from roentgen import mapcss
|
||||
from map_machine import mapcss
|
||||
|
||||
mapcss.ui(arguments)
|
||||
|
||||
elif arguments.command == "element":
|
||||
from roentgen.element import draw_element
|
||||
from map_machine.element import draw_element
|
||||
|
||||
draw_element(arguments)
|
||||
|
||||
elif arguments.command == "server":
|
||||
from roentgen import server
|
||||
from map_machine import server
|
||||
|
||||
server.ui(arguments)
|
||||
|
||||
elif arguments.command == "taginfo":
|
||||
from roentgen.scheme import Scheme
|
||||
from roentgen.taginfo import write_taginfo_project_file
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.taginfo import write_taginfo_project_file
|
||||
|
||||
write_taginfo_project_file(Scheme(workspace.DEFAULT_SCHEME_PATH))
|
||||
|
|
@ -8,12 +8,12 @@ from typing import Optional, TextIO
|
|||
|
||||
from colour import Color
|
||||
|
||||
from roentgen import __project__, __url__
|
||||
from roentgen.grid import IconCollection
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from roentgen.osm_reader import STAGES_OF_DECAY
|
||||
from roentgen.scheme import Matcher, Scheme
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine import __project__, __url__
|
||||
from map_machine.grid import IconCollection
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.osm_reader import STAGES_OF_DECAY
|
||||
from map_machine.scheme import Matcher, Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
@ -59,7 +59,7 @@ Map paint style that adds icons from Röntgen icon set
|
|||
|
||||
meta {{
|
||||
title: "{__project__}";
|
||||
description: "Röntgen map paint style for JOSM";
|
||||
description: "Map Machine map paint style for JOSM";
|
||||
author: "{__author__}";
|
||||
version: "0.1";
|
||||
link: "{__url__}";
|
||||
|
@ -68,7 +68,7 @@ meta {{
|
|||
|
||||
class MapCSSWriter:
|
||||
"""
|
||||
Writer that converts Röntgen scheme into MapCSS 0.2 format.
|
||||
Writer that converts Map Machine scheme into MapCSS 0.2 format.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
@ -98,7 +98,7 @@ class MapCSSWriter:
|
|||
Add MapCSS 0.2 selector for node, way, relation, or area.
|
||||
|
||||
:param target: `node`, `way`, `relation`, or `area`
|
||||
:param matcher: tag matcher of Röntgen scheme
|
||||
:param matcher: tag matcher of Map Machine scheme
|
||||
:param prefix: tag prefix
|
||||
:param opacity: icon opacity
|
||||
:return: string representation of selector
|
|
@ -13,19 +13,19 @@ from svgwrite.container import Group
|
|||
from svgwrite.path import Path as SVGPath
|
||||
from svgwrite.shapes import Rect
|
||||
|
||||
from roentgen.boundary_box import BoundaryBox
|
||||
from roentgen.constructor import Constructor
|
||||
from roentgen.figure import Road, StyledFigure
|
||||
from roentgen.flinger import Flinger
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from roentgen.map_configuration import LabelMode, MapConfiguration
|
||||
from roentgen.osm_getter import NetworkError, get_osm
|
||||
from roentgen.osm_reader import OSMData, OSMNode, OSMReader, OverpassReader
|
||||
from roentgen.point import Occupied, Point
|
||||
from roentgen.road import Intersection, RoadPart
|
||||
from roentgen.scheme import Scheme
|
||||
from roentgen.ui import BuildingMode, progress_bar
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.constructor import Constructor
|
||||
from map_machine.figure import Road, StyledFigure
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.map_configuration import LabelMode, MapConfiguration
|
||||
from map_machine.osm_getter import NetworkError, get_osm
|
||||
from map_machine.osm_reader import OSMData, OSMNode, OSMReader, OverpassReader
|
||||
from map_machine.point import Occupied, Point
|
||||
from map_machine.road import Intersection, RoadPart
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.ui import BuildingMode, progress_bar
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
@ -215,7 +215,7 @@ class Map:
|
|||
|
||||
def ui(options: argparse.Namespace) -> None:
|
||||
"""
|
||||
Röntgen entry point.
|
||||
Map Machine entry point.
|
||||
|
||||
:param options: command-line arguments
|
||||
"""
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Moire markup extension for Röntgen.
|
||||
Moire markup extension for Map Machine.
|
||||
"""
|
||||
import argparse
|
||||
from abc import ABC
|
||||
|
@ -10,9 +10,9 @@ import yaml
|
|||
from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki
|
||||
from moire.moire import Tag
|
||||
|
||||
from roentgen import ui
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine import ui
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
@ -143,9 +143,9 @@ test_configuration: TestConfiguration = TestConfiguration(
|
|||
)
|
||||
|
||||
|
||||
class RoentgenMoire(Default, ABC):
|
||||
class MapMachineMoire(Default, ABC):
|
||||
"""
|
||||
Moire extension stub for Röntgen.
|
||||
Moire extension stub for Map Machine.
|
||||
"""
|
||||
|
||||
def osm(self, args: Arguments) -> str:
|
||||
|
@ -212,7 +212,7 @@ class RoentgenMoire(Default, ABC):
|
|||
return self.parse(args[0])
|
||||
|
||||
|
||||
class RoentgenHTML(RoentgenMoire, DefaultHTML):
|
||||
class MapMachineHTML(MapMachineMoire, DefaultHTML):
|
||||
"""
|
||||
Simple HTML.
|
||||
"""
|
||||
|
@ -272,7 +272,7 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML):
|
|||
return f'<span class="formal">{self.parse(args[0])}</span>'
|
||||
|
||||
|
||||
class RoentgenOSMWiki(RoentgenMoire, DefaultWiki):
|
||||
class MapMachineOSMWiki(MapMachineMoire, DefaultWiki):
|
||||
"""
|
||||
OpenStreetMap wiki.
|
||||
|
||||
|
@ -307,7 +307,7 @@ class RoentgenOSMWiki(RoentgenMoire, DefaultWiki):
|
|||
return f"[[File:Röntgen {name}.svg|{size}px]]"
|
||||
|
||||
|
||||
class RoentgenMarkdown(RoentgenMoire, DefaultMarkdown):
|
||||
class MapMachineMarkdown(MapMachineMoire, DefaultMarkdown):
|
||||
"""
|
||||
GitHub flavored markdown.
|
||||
"""
|
||||
|
@ -335,3 +335,9 @@ class RoentgenMarkdown(RoentgenMoire, DefaultMarkdown):
|
|||
def formal(self, args: Arguments) -> str:
|
||||
"""Formal variable."""
|
||||
return f"<{self.parse(args[0])}>"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with Path("doc/readme.moi").open() as input_file:
|
||||
with Path("README.md").open("w+") as output_file:
|
||||
output_file.write(MapMachineMarkdown().convert(input_file.read()))
|
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||
|
||||
import urllib3
|
||||
|
||||
from roentgen.boundary_box import BoundaryBox
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -12,8 +12,8 @@ from xml.etree.ElementTree import Element
|
|||
|
||||
import numpy as np
|
||||
|
||||
from roentgen.boundary_box import BoundaryBox
|
||||
from roentgen.util import MinMax
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.util import MinMax
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -7,10 +7,10 @@ import numpy as np
|
|||
import svgwrite
|
||||
from colour import Color
|
||||
|
||||
from roentgen.icon import Icon, IconSet
|
||||
from roentgen.map_configuration import LabelMode
|
||||
from roentgen.osm_reader import Tagged
|
||||
from roentgen.text import Label
|
||||
from map_machine.icon import Icon, IconSet
|
||||
from map_machine.map_configuration import LabelMode
|
||||
from map_machine.osm_reader import Tagged
|
||||
from map_machine.text import Label
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -8,7 +8,7 @@ import numpy as np
|
|||
import svgwrite
|
||||
from svgwrite.path import Path
|
||||
|
||||
from roentgen.vector import Line, compute_angle, norm, turn_by_angle
|
||||
from map_machine.vector import Line, compute_angle, norm, turn_by_angle
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Röntgen drawing scheme.
|
||||
Map Machine drawing scheme.
|
||||
"""
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
|
@ -11,8 +11,8 @@ import numpy as np
|
|||
import yaml
|
||||
from colour import Color
|
||||
|
||||
from roentgen.direction import DirectionSet
|
||||
from roentgen.icon import (
|
||||
from map_machine.direction import DirectionSet
|
||||
from map_machine.icon import (
|
||||
DEFAULT_COLOR,
|
||||
DEFAULT_SHAPE_ID,
|
||||
Icon,
|
||||
|
@ -21,7 +21,7 @@ from roentgen.icon import (
|
|||
ShapeExtractor,
|
||||
ShapeSpecification,
|
||||
)
|
||||
from roentgen.text import Label, get_address, get_text
|
||||
from map_machine.text import Label, get_address, get_text
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Röntgen tile server for slippy maps.
|
||||
Map Machine tile server for slippy maps.
|
||||
"""
|
||||
import argparse
|
||||
import logging
|
||||
|
@ -9,8 +9,8 @@ from typing import Optional
|
|||
|
||||
import cairosvg
|
||||
|
||||
from roentgen.tile import Tile
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine.tile import Tile
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -8,7 +8,7 @@ import logging
|
|||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
from roentgen import (
|
||||
from map_machine import (
|
||||
__author__,
|
||||
__description__,
|
||||
__doc_url__,
|
||||
|
@ -16,8 +16,8 @@ from roentgen import (
|
|||
__project__,
|
||||
__url__,
|
||||
)
|
||||
from roentgen.scheme import Scheme
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
|
||||
class TaginfoProjectFile:
|
||||
|
@ -37,7 +37,7 @@ class TaginfoProjectFile:
|
|||
"description": __description__,
|
||||
"project_url": __url__,
|
||||
"doc_url": __doc_url__,
|
||||
"icon_url": "http://enzet.ru/roentgen/image/logo.png",
|
||||
"icon_url": "http://enzet.ru/map-machine/image/logo.png",
|
||||
"contact_name": __author__,
|
||||
"contact_email": __email__,
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ class TaginfoProjectFile:
|
|||
"value": value,
|
||||
"object_types": ["node", "area"],
|
||||
"description": "Rendered",
|
||||
"icon_url": "http://enzet.ru/roentgen/"
|
||||
"icon_url": "http://enzet.ru/map-machine/"
|
||||
f"roentgen_icons_mapcss/{icon_id}.svg",
|
||||
}
|
||||
tags.append(tag)
|
||||
|
@ -80,7 +80,7 @@ class TaginfoProjectFile:
|
|||
def write_taginfo_project_file(scheme: Scheme) -> None:
|
||||
"""Write Taginfo JSON file."""
|
||||
out_file: Path = workspace.get_taginfo_file_path()
|
||||
logging.info(f"Write Röntgen project file for Taginfo to {out_file}...")
|
||||
logging.info(f"Write Map Machine project file for Taginfo to {out_file}...")
|
||||
taginfo_project_file: TaginfoProjectFile = TaginfoProjectFile(
|
||||
out_file, scheme
|
||||
)
|
|
@ -15,16 +15,16 @@ import numpy as np
|
|||
import svgwrite
|
||||
from PIL import Image
|
||||
|
||||
from roentgen.boundary_box import BoundaryBox
|
||||
from roentgen.constructor import Constructor
|
||||
from roentgen.flinger import Flinger
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from roentgen.map_configuration import MapConfiguration
|
||||
from roentgen.mapper import Map
|
||||
from roentgen.osm_getter import NetworkError, get_osm
|
||||
from roentgen.osm_reader import OSMData, OSMReader
|
||||
from roentgen.scheme import Scheme
|
||||
from roentgen.workspace import workspace
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
from map_machine.constructor import Constructor
|
||||
from map_machine.flinger import Flinger
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.map_configuration import MapConfiguration
|
||||
from map_machine.mapper import Map
|
||||
from map_machine.osm_getter import NetworkError, get_osm
|
||||
from map_machine.osm_reader import OSMData, OSMReader
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.workspace import workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
|
@ -4,9 +4,9 @@ Command-line user interface.
|
|||
import argparse
|
||||
import sys
|
||||
|
||||
from roentgen import __version__
|
||||
from roentgen.map_configuration import BuildingMode, DrawingMode, LabelMode
|
||||
from roentgen.osm_reader import STAGES_OF_DECAY
|
||||
from map_machine import __version__
|
||||
from map_machine.map_configuration import BuildingMode, DrawingMode, LabelMode
|
||||
from map_machine.osm_reader import STAGES_OF_DECAY
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
@ -16,15 +16,15 @@ BOXES_LENGTH: int = len(BOXES)
|
|||
|
||||
|
||||
def parse_options(args: list[str]) -> argparse.Namespace:
|
||||
"""Parse Röntgen command-line options."""
|
||||
"""Parse Map Machine command-line options."""
|
||||
parser: argparse.ArgumentParser = argparse.ArgumentParser(
|
||||
description="Röntgen. OpenStreetMap renderer with custom icon set"
|
||||
description="Map Machine. OpenStreetMap renderer with custom icon set"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--version",
|
||||
action="version",
|
||||
version="Röntgen " + __version__,
|
||||
version="Map Machine " + __version__,
|
||||
)
|
||||
subparser = parser.add_subparsers(dest="command")
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Röntgen utility file.
|
||||
Utility file.
|
||||
"""
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
|
@ -39,7 +39,7 @@ class Workspace:
|
|||
|
||||
self._icons_by_id_path: Path = output_path / "icons_by_id"
|
||||
self._icons_by_name_path: Path = output_path / "icons_by_name"
|
||||
self._mapcss_path: Path = output_path / "roentgen_mapcss"
|
||||
self._mapcss_path: Path = output_path / "map_machine_mapcss"
|
||||
self._tile_path: Path = output_path / "tiles"
|
||||
|
||||
def get_icons_by_id_path(self) -> Path:
|
||||
|
@ -60,7 +60,7 @@ class Workspace:
|
|||
|
||||
def get_mapcss_file_path(self) -> Path:
|
||||
"""Directory for MapCSS files."""
|
||||
return self.get_mapcss_path() / "roentgen.mapcss"
|
||||
return self.get_mapcss_path() / "map_machine.mapcss"
|
||||
|
||||
def get_mapcss_icons_path(self) -> Path:
|
||||
"""Directory for icons used by MapCSS file."""
|
||||
|
@ -74,7 +74,7 @@ class Workspace:
|
|||
|
||||
def get_taginfo_file_path(self) -> Path:
|
||||
"""Path to file with project information for Taginfo."""
|
||||
return self.output_path / "roentgen_taginfo.json"
|
||||
return self.output_path / "map_machine_taginfo.json"
|
||||
|
||||
|
||||
workspace = Workspace(Path("out"))
|
|
@ -1,7 +0,0 @@
|
|||
"""
|
||||
Röntgen entry point.
|
||||
"""
|
||||
from roentgen.main import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
14
setup.py
14
setup.py
|
@ -1,10 +1,10 @@
|
|||
"""
|
||||
Röntgen project dynamic metadata.
|
||||
Map Machine project dynamic metadata.
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from setuptools import setup
|
||||
from roentgen import (
|
||||
from map_machine import (
|
||||
__author__,
|
||||
__description__,
|
||||
__doc_url__,
|
||||
|
@ -17,9 +17,9 @@ with Path("README.md").open() as input_file:
|
|||
long_description: str = input_file.read()
|
||||
|
||||
setup(
|
||||
name="roentgen-map",
|
||||
name="map-machine",
|
||||
version=__version__,
|
||||
packages=["roentgen"],
|
||||
packages=["map_machine"],
|
||||
url=__url__,
|
||||
project_urls={
|
||||
"Bug Tracker": f"{__url__}/issues",
|
||||
|
@ -33,16 +33,16 @@ setup(
|
|||
author=__author__,
|
||||
author_email=__email__,
|
||||
description=__description__,
|
||||
long_description="Röntgen is a Python OpenStreetMap renderer and tile "
|
||||
long_description="Map Machine is a Python OpenStreetMap renderer and tile "
|
||||
"generator with a custom set of CC-BY 4.0 icons aimed to display as many "
|
||||
"map features as possible.\n\n"
|
||||
f"See [full documentation]({__doc_url__}).",
|
||||
long_description_content_type="text/markdown",
|
||||
entry_points={
|
||||
"console_scripts": ["roentgen=roentgen.main:main"],
|
||||
"console_scripts": ["map-machine=map_machine.main:main"],
|
||||
},
|
||||
package_data={
|
||||
"roentgen": [
|
||||
"map_machine": [
|
||||
"icons/icons.svg",
|
||||
"icons/config.json",
|
||||
"icons/LICENSE",
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""
|
||||
Tests for Röntgen project.
|
||||
Tests for Map Machine project.
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from roentgen.scheme import Scheme
|
||||
from roentgen.workspace import Workspace
|
||||
from map_machine.icon import ShapeExtractor
|
||||
from map_machine.scheme import Scheme
|
||||
from map_machine.workspace import Workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Test boundary box.
|
||||
"""
|
||||
from roentgen.boundary_box import BoundaryBox
|
||||
from map_machine.boundary_box import BoundaryBox
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,8 +3,8 @@ Test color functions.
|
|||
"""
|
||||
from colour import Color
|
||||
|
||||
from roentgen.color import get_gradient_color, is_bright
|
||||
from roentgen.util import MinMax
|
||||
from map_machine.color import get_gradient_color, is_bright
|
||||
from map_machine.util import MinMax
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,7 +3,7 @@ Test direction processing.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from roentgen.direction import DirectionSet, parse_vector
|
||||
from map_machine.direction import DirectionSet, parse_vector
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,7 +3,10 @@ Test coordinates computation.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from roentgen.flinger import osm_zoom_level_to_pixels_per_meter, pseudo_mercator
|
||||
from map_machine.flinger import (
|
||||
osm_zoom_level_to_pixels_per_meter,
|
||||
pseudo_mercator,
|
||||
)
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,8 +3,8 @@ Test icon generation for nodes.
|
|||
"""
|
||||
import pytest
|
||||
|
||||
from roentgen.grid import IconCollection
|
||||
from roentgen.icon import IconSet
|
||||
from map_machine.grid import IconCollection
|
||||
from map_machine.icon import IconSet
|
||||
from tests import SCHEME, SHAPE_EXTRACTOR, workspace
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Test label generation for nodes.
|
||||
"""
|
||||
from roentgen.text import Label
|
||||
from map_machine.text import Label
|
||||
from tests import SCHEME
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""
|
||||
Test MapCSS generation.
|
||||
"""
|
||||
from roentgen.mapcss import MapCSSWriter
|
||||
from roentgen.scheme import NodeMatcher
|
||||
from map_machine.mapcss import MapCSSWriter
|
||||
from map_machine.scheme import NodeMatcher
|
||||
from tests import SCHEME
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
|
|
|
@ -3,7 +3,13 @@ Test OSM XML parsing.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from roentgen.osm_reader import OSMNode, OSMReader, OSMRelation, OSMWay, OSMData
|
||||
from map_machine.osm_reader import (
|
||||
OSMNode,
|
||||
OSMReader,
|
||||
OSMRelation,
|
||||
OSMWay,
|
||||
OSMData,
|
||||
)
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,7 +3,7 @@ Tests for length tag parsing.
|
|||
"""
|
||||
from typing import Optional
|
||||
|
||||
from roentgen.osm_reader import Tagged
|
||||
from map_machine.osm_reader import Tagged
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Test text generation.
|
||||
"""
|
||||
from roentgen.text import format_voltage
|
||||
from map_machine.text import format_voltage
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -3,7 +3,7 @@ Test vector operations.
|
|||
"""
|
||||
import numpy as np
|
||||
|
||||
from roentgen.vector import compute_angle, turn_by_angle
|
||||
from map_machine.vector import compute_angle, turn_by_angle
|
||||
|
||||
__author__ = "Sergey Vartanov"
|
||||
__email__ = "me@enzet.ru"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Test zoom level specification parsing.
|
||||
"""
|
||||
from roentgen.tile import ScaleConfigurationException, parse_zoom_level
|
||||
from map_machine.tile import ScaleConfigurationException, parse_zoom_level
|
||||
|
||||
|
||||
def test_zoom_level_1() -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue