mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-08 22:01:51 +02:00
Issue #109: improve negative value warnings.
Add alternative approach and examples.
This commit is contained in:
parent
f487f75f42
commit
7ce9a495d9
2 changed files with 21 additions and 9 deletions
|
@ -173,10 +173,10 @@ will download OSM data to `cache/2.284,48.860,2.290,48.865.osm` and write an out
|
||||||
|---|---|
|
|---|---|
|
||||||
| <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) |
|
| <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) |
|
||||||
| <span style="white-space: nowrap;">`-o`</span>, <span style="white-space: nowrap;">`--output`</span> `<path>` | 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` |
|
||||||
| <span style="white-space: nowrap;">`-b`</span>, <span style="white-space: nowrap;">`--boundary-box`</span> `<lon1>,<lat1>,<lon2>,<lat2>` | geo boundary box; if the first value is negative, enclose the value with quotes and use space before `-` |
|
| <span style="white-space: nowrap;">`-b`</span>, <span style="white-space: nowrap;">`--boundary-box`</span> `<lon1>,<lat1>,<lon2>,<lat2>` | geo boundary box; if the first value is negative, use `=` sign or enclose the value with quotes and use space before `-`, e.g. `-b=-84.752,39.504,-84.749,39.508` or `-b " -84.752,39.504,-84.749,39.508"` |
|
||||||
| <span style="white-space: nowrap;">`--cache`</span> `<path>` | path for temporary OSM files, default value: `cache` |
|
| <span style="white-space: nowrap;">`--cache`</span> `<path>` | path for temporary OSM files, default value: `cache` |
|
||||||
| <span style="white-space: nowrap;">`-z`</span>, <span style="white-space: nowrap;">`--zoom`</span> `<float>` | OSM zoom level, default value: 18.0 |
|
| <span style="white-space: nowrap;">`-z`</span>, <span style="white-space: nowrap;">`--zoom`</span> `<float>` | OSM zoom level, default value: 18.0 |
|
||||||
| <span style="white-space: nowrap;">`-c`</span>, <span style="white-space: nowrap;">`--coordinates`</span> `<latitude>,<longitude>` | 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; if the first value is negative, use `=` sign or enclose the value with quotes and use space before `-`, e.g. `-c=-84.752,39.504` or `-c " -84.752,39.504"` |
|
||||||
| <span style="white-space: nowrap;">`-s`</span>, <span style="white-space: nowrap;">`--size`</span> `<width>,<height>` | resulted image size |
|
| <span style="white-space: nowrap;">`-s`</span>, <span style="white-space: nowrap;">`--size`</span> `<width>,<height>` | resulted image size |
|
||||||
|
|
||||||
plus [map configuration options](#map-options)
|
plus [map configuration options](#map-options)
|
||||||
|
@ -188,10 +188,10 @@ Command `tile` is used to generate PNG tiles for [slippy maps](https://wiki.open
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
|---|---|
|
|---|---|
|
||||||
| <span style="white-space: nowrap;">`-c`</span>, <span style="white-space: nowrap;">`--coordinates`</span> `<latitude>,<longitude>` | 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; if the first value is negative, use `=` sign or enclose the value with quotes and use space before `-`, e.g. `-c=-84.752,39.504` or `-c " -84.752,39.504"` |
|
||||||
| <span style="white-space: nowrap;">`-t`</span>, <span style="white-space: nowrap;">`--tile`</span> `<zoom level>/<x>/<y>` | tile specification |
|
| <span style="white-space: nowrap;">`-t`</span>, <span style="white-space: nowrap;">`--tile`</span> `<zoom level>/<x>/<y>` | tile specification |
|
||||||
| <span style="white-space: nowrap;">`--cache`</span> `<path>` | path for temporary OSM files, default value: `cache` |
|
| <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 the 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 the requested boundary box; if the first value is negative, use `=` sign or enclose the value with quotes and use space before `-`, e.g. `-b=-84.752,39.504,-84.749,39.508` or `-b " -84.752,39.504,-84.749,39.508"` |
|
||||||
| <span style="white-space: nowrap;">`-z`</span>, <span style="white-space: nowrap;">`--zoom`</span> `<range>` | 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;">`-z`</span>, <span style="white-space: nowrap;">`--zoom`</span> `<range>` | 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, the file will be downloaded using OpenStreetMap API) |
|
| <span style="white-space: nowrap;">`-i`</span>, <span style="white-space: nowrap;">`--input`</span> `<path>` | input OSM XML file name (if not specified, the file will be downloaded using OpenStreetMap API) |
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,17 @@ COMMANDS: list[str] = [
|
||||||
"taginfo",
|
"taginfo",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
BOUNDARY_BOX_WARNING: str = (
|
||||||
|
"if the first value is negative, use `=` sign or enclose the value with "
|
||||||
|
"quotes and use space before `-`, e.g. `-b=-84.752,39.504,-84.749,39.508` "
|
||||||
|
'or `-b " -84.752,39.504,-84.749,39.508"`'
|
||||||
|
)
|
||||||
|
COORDINATES_WARNING: str = (
|
||||||
|
"if the first value is negative, use `=` sign or enclose the value with "
|
||||||
|
"quotes and use space before `-`, e.g. `-c=-84.752,39.504` or `-c "
|
||||||
|
'" -84.752,39.504"`'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments(args: list[str]) -> argparse.Namespace:
|
def parse_arguments(args: list[str]) -> argparse.Namespace:
|
||||||
"""Parse Map Machine command-line arguments."""
|
"""Parse Map Machine command-line arguments."""
|
||||||
|
@ -191,7 +202,8 @@ def add_tile_arguments(parser: argparse.ArgumentParser) -> None:
|
||||||
"-c",
|
"-c",
|
||||||
"--coordinates",
|
"--coordinates",
|
||||||
metavar="<latitude>,<longitude>",
|
metavar="<latitude>,<longitude>",
|
||||||
help="coordinates of any location inside the tile",
|
help="coordinates of any location inside the tile; "
|
||||||
|
+ COORDINATES_WARNING,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-t",
|
"-t",
|
||||||
|
@ -209,7 +221,7 @@ def add_tile_arguments(parser: argparse.ArgumentParser) -> None:
|
||||||
"-b",
|
"-b",
|
||||||
"--boundary-box",
|
"--boundary-box",
|
||||||
help="construct the minimum amount of tiles that cover the requested "
|
help="construct the minimum amount of tiles that cover the requested "
|
||||||
"boundary box",
|
"boundary box; " + BOUNDARY_BOX_WARNING,
|
||||||
metavar="<lon1>,<lat1>,<lon2>,<lat2>",
|
metavar="<lon1>,<lat1>,<lon2>,<lat2>",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -278,8 +290,7 @@ 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; if the first value is negative, enclose the "
|
help="geo boundary box; " + BOUNDARY_BOX_WARNING,
|
||||||
"value with quotes and use space before `-`",
|
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--cache",
|
"--cache",
|
||||||
|
@ -299,7 +310,8 @@ def add_render_arguments(parser: argparse.ArgumentParser) -> None:
|
||||||
"-c",
|
"-c",
|
||||||
"--coordinates",
|
"--coordinates",
|
||||||
metavar="<latitude>,<longitude>",
|
metavar="<latitude>,<longitude>",
|
||||||
help="coordinates of any location inside the tile",
|
help="coordinates of any location inside the tile; "
|
||||||
|
+ COORDINATES_WARNING,
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue