| 27 | |
| 28 | |
| 29 | def parse_args(): |
| 30 | parser = argparse.ArgumentParser( |
| 31 | description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter |
| 32 | ) |
| 33 | |
| 34 | parser.add_argument( |
| 35 | "--input", |
| 36 | "-i", |
| 37 | type=argparse.FileType("r"), |
| 38 | default=sys.stdin, |
| 39 | help="The WKT/WKB input to parse. Defaults to stdin.", |
| 40 | ) |
| 41 | parser.add_argument( |
| 42 | "--output", |
| 43 | "-o", |
| 44 | type=argparse.FileType("w"), |
| 45 | default=sys.stdout, |
| 46 | help="Where to output the WKT/WKB. Defaults to stdout.", |
| 47 | ) |
| 48 | parser.add_argument( |
| 49 | "--input-format", |
| 50 | "-I", |
| 51 | default="wkt", |
| 52 | choices=["wkt", "wkb", "flat"], |
| 53 | help="The input geometry format. Defaults to WKT. Use 'flat' for better performance.", |
| 54 | ) |
| 55 | parser.add_argument( |
| 56 | "--output-format", |
| 57 | "-O", |
| 58 | default="wkt", |
| 59 | choices=["wkt", "wkb", "flat"], |
| 60 | help="The output geometry format. Defaults to WKT. Use 'flat' for better performance.", |
| 61 | ) |
| 62 | parser.add_argument( |
| 63 | "-l", |
| 64 | "--log-level", |
| 65 | type=str, |
| 66 | default=DEFAULT_LEVEL, |
| 67 | choices=LOG_LEVELS.keys(), |
| 68 | help=f"Set the logging output level. Defaults to {DEFAULT_LEVEL}.", |
| 69 | ) |
| 70 | parser.add_argument( |
| 71 | "--kind", |
| 72 | "-k", |
| 73 | default="pca", |
| 74 | choices=["xy", "xz", "yz", "pca", "svd", "I", "isometric", "auto"], |
| 75 | help="What kind of projection to use. Defaults to using PCA to pick a 2D basis.", |
| 76 | ) |
| 77 | parser.add_argument( |
| 78 | "--dimensions", |
| 79 | "-n", |
| 80 | type=int, |
| 81 | default=2, |
| 82 | choices=[2, 3], |
| 83 | help="The target dimensionality for the PCA, SVD, or Isometric projections.", |
| 84 | ) |
| 85 | parser.add_argument( |
| 86 | "--scale", "-s", type=float, default=1, help="A multiplicative scale factor" |