mirror of
https://github.com/enzet/map-machine.git
synced 2025-08-03 16:49:10 +02:00
Fix command-line interface.
This commit is contained in:
parent
77ae8fe4a3
commit
f0c8ee6de1
4 changed files with 21 additions and 14 deletions
|
@ -52,7 +52,7 @@ If tag is drawable it is displayed using icon combination and colors. All icons
|
|||
|
||||
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.
|
||||
|
||||
Draw icon grid\: \tt {python run.py grid}.
|
||||
Draw icon grid\: \tt {python roentgen.py grid}.
|
||||
|
||||
\3 {Icon combination} {icon_combination}
|
||||
|
||||
|
@ -92,14 +92,14 @@ Every way and node displayed with the random color picked for each author with \
|
|||
|
||||
There are simple Python renderer that generates SVG map from OpenStreetMap data. You can run it using\:
|
||||
|
||||
\code {python run.py \\
|
||||
\code {python roentgen.py \\
|
||||
-b $\{LONGITUDE_1\},$\{LATITUDE_1\},$\{LONGITUDE_2\},$\{LATITUDE_2\} \\
|
||||
-o $\{OUTPUT_FILE_NAME\} \\
|
||||
-s $\{OSM_ZOOM_LEVEL\}} {bash}
|
||||
|
||||
Example\:
|
||||
|
||||
\code {python run.py -b 2.284,48.86,2.29,48.865} {bash}
|
||||
\code {python roentgen.py -b 2.284,48.86,2.29,48.865} {bash}
|
||||
|
||||
\3 {Main arguments} {arguments}
|
||||
|
||||
|
@ -115,4 +115,4 @@ Example\:
|
|||
{\tt {-o}\: path to output SVG file name. Default is \tt {map.svg}.}
|
||||
{\tt {-i}\: path to input XML file name. If this argument is not set, XML file will be downloaded through OpenStreetMap API.}
|
||||
|
||||
Check all arguments with \tt {python run.py --help}.
|
||||
Check all arguments with \tt {python roentgen.py --help}.
|
||||
|
|
|
@ -54,7 +54,7 @@ If tag is drawable it is displayed using icon combination and colors. All icons
|
|||
|
||||
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.
|
||||
|
||||
Draw icon grid: `python run.py grid`.
|
||||
Draw icon grid: `python roentgen.py grid`.
|
||||
|
||||
### Icon combination ###
|
||||
|
||||
|
@ -97,7 +97,7 @@ Map generation
|
|||
There are simple Python renderer that generates SVG map from OpenStreetMap data. You can run it using:
|
||||
|
||||
```bash
|
||||
python run.py \
|
||||
python roentgen.py \
|
||||
-b ${LONGITUDE_1},${LATITUDE_1},${LONGITUDE_2},${LATITUDE_2} \
|
||||
-o ${OUTPUT_FILE_NAME} \
|
||||
-s ${OSM_ZOOM_LEVEL}
|
||||
|
@ -106,7 +106,7 @@ python run.py \
|
|||
Example:
|
||||
|
||||
```bash
|
||||
python run.py -b 2.284,48.86,2.29,48.865
|
||||
python roentgen.py -b 2.284,48.86,2.29,48.865
|
||||
```
|
||||
|
||||
### Main arguments ###
|
||||
|
@ -121,5 +121,5 @@ python run.py -b 2.284,48.86,2.29,48.865
|
|||
* `-o`: path to output SVG file name. Default is `map.svg`.
|
||||
* `-i`: path to input XML file name. If this argument is not set, XML file will be downloaded through OpenStreetMap API.
|
||||
|
||||
Check all arguments with `python run.py --help`.
|
||||
Check all arguments with `python roentgen.py --help`.
|
||||
|
||||
|
|
|
@ -31,12 +31,6 @@ def main(argv) -> None:
|
|||
|
||||
:param argv: command-line arguments
|
||||
"""
|
||||
if len(argv) == 2:
|
||||
if argv[1] == "grid":
|
||||
os.makedirs("icon_set", exist_ok=True)
|
||||
draw_all_icons("icon_grid.svg", "icon_set")
|
||||
return
|
||||
|
||||
options: argparse.Namespace = ui.parse_options(argv)
|
||||
|
||||
if not options:
|
||||
|
@ -132,11 +126,19 @@ def draw_icon(tags_description: str):
|
|||
svg = svgwrite.Drawing("test_icon.svg", (64, 64))
|
||||
point.draw_main_shapes(svg)
|
||||
point.draw_extra_shapes(svg)
|
||||
point.draw_texts(svg, scheme, None, True)
|
||||
svg.write(open("test_icon.svg", "w+"))
|
||||
|
||||
|
||||
def draw_grid():
|
||||
os.makedirs("icon_set", exist_ok=True)
|
||||
draw_all_icons("icon_grid.svg", "icon_set")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 3 and sys.argv[1] == "icon":
|
||||
draw_icon(sys.argv[2])
|
||||
elif len(sys.argv) == 2 and sys.argv[1] == "grid":
|
||||
draw_grid()
|
||||
else:
|
||||
main(sys.argv)
|
5
roentgen/__init__.py
Normal file
5
roentgen/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
__url__ = "https://github.com/enzet/Roentgen"
|
||||
__maintainer__ = "Sergey Vartanov"
|
||||
__maintainer_email__ = "me@enzet.ru"
|
||||
__author__ = __maintainer__
|
||||
__author_email__ = __maintainer_email__
|
Loading…
Add table
Add a link
Reference in a new issue